#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub enum CandidateModel {
KernelClassProtocol,
PythonClassSpace,
JavascriptPrototype,
LuaMetatable,
TypeclassDictionary,
PrologRelation,
GenericDispatch,
JvmLoaderIdentity,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CandidateDisposition {
Reuse,
Compose,
Exclude,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SemanticDomain {
ClassProtocol,
ClassInheritance,
PropertyLookup,
MetamethodLookup,
ConstraintEvidence,
LogicalRelation,
MethodSelection,
RuntimeTypeIdentity,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ParentMeaning {
DeclaredSuperclass,
ProtocolReportedSuperclass,
PrototypeDelegate,
MetatableDelegate,
ConstraintWitness,
PredicateArgument,
ApplicableMethod,
DefiningLoaderIdentity,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct SemanticCandidate {
pub model: CandidateModel,
pub disposition: CandidateDisposition,
pub domain: SemanticDomain,
pub declared_parent: ParentMeaning,
pub source_anchor: &'static str,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct ExclusionReason {
pub model: CandidateModel,
pub required: ParentMeaning,
pub actual: ParentMeaning,
pub mismatch_code: &'static str,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct NonGoal {
pub model: CandidateModel,
pub excluded_semantics: &'static str,
}
pub const fn candidate_inventory() -> &'static [SemanticCandidate] {
&[
SemanticCandidate {
model: CandidateModel::KernelClassProtocol,
disposition: CandidateDisposition::Reuse,
domain: SemanticDomain::ClassProtocol,
declared_parent: ParentMeaning::ProtocolReportedSuperclass,
source_anchor: "sim-kernel/src/class.rs",
},
SemanticCandidate {
model: CandidateModel::PythonClassSpace,
disposition: CandidateDisposition::Compose,
domain: SemanticDomain::ClassInheritance,
declared_parent: ParentMeaning::DeclaredSuperclass,
source_anchor: "sim-runtime/crates/sim-lib-lang-python/src/objects.rs",
},
SemanticCandidate {
model: CandidateModel::JavascriptPrototype,
disposition: CandidateDisposition::Exclude,
domain: SemanticDomain::PropertyLookup,
declared_parent: ParentMeaning::PrototypeDelegate,
source_anchor: "sim-runtime/crates/sim-lib-lang-javascript/src/objects/space.rs",
},
SemanticCandidate {
model: CandidateModel::LuaMetatable,
disposition: CandidateDisposition::Exclude,
domain: SemanticDomain::MetamethodLookup,
declared_parent: ParentMeaning::MetatableDelegate,
source_anchor: "sim-runtime/crates/sim-lib-lang-lua/src/metatable.rs",
},
SemanticCandidate {
model: CandidateModel::TypeclassDictionary,
disposition: CandidateDisposition::Exclude,
domain: SemanticDomain::ConstraintEvidence,
declared_parent: ParentMeaning::ConstraintWitness,
source_anchor: "sim-runtime/crates/sim-lib-lang-typed-lazy/src/runtime.rs",
},
SemanticCandidate {
model: CandidateModel::PrologRelation,
disposition: CandidateDisposition::Exclude,
domain: SemanticDomain::LogicalRelation,
declared_parent: ParentMeaning::PredicateArgument,
source_anchor: "sim-runtime/crates/sim-lib-lang-prolog/src/surface.rs",
},
SemanticCandidate {
model: CandidateModel::GenericDispatch,
disposition: CandidateDisposition::Exclude,
domain: SemanticDomain::MethodSelection,
declared_parent: ParentMeaning::ApplicableMethod,
source_anchor: "sim-runtime/crates/sim-lib-dispatch/src/method.rs",
},
SemanticCandidate {
model: CandidateModel::JvmLoaderIdentity,
disposition: CandidateDisposition::Exclude,
domain: SemanticDomain::RuntimeTypeIdentity,
declared_parent: ParentMeaning::DefiningLoaderIdentity,
source_anchor: "no-owner:index-and-source-inventory",
},
]
}
pub const fn exclusion_ledger() -> &'static [ExclusionReason] {
&[
ExclusionReason {
model: CandidateModel::JavascriptPrototype,
required: ParentMeaning::DeclaredSuperclass,
actual: ParentMeaning::PrototypeDelegate,
mismatch_code: "prototype-delegates-properties-not-declared-ancestry",
},
ExclusionReason {
model: CandidateModel::LuaMetatable,
required: ParentMeaning::DeclaredSuperclass,
actual: ParentMeaning::MetatableDelegate,
mismatch_code: "metatable-delegates-operations-not-declared-ancestry",
},
ExclusionReason {
model: CandidateModel::TypeclassDictionary,
required: ParentMeaning::DeclaredSuperclass,
actual: ParentMeaning::ConstraintWitness,
mismatch_code: "dictionary-witnesses-constraint-not-subclass-edge",
},
ExclusionReason {
model: CandidateModel::PrologRelation,
required: ParentMeaning::DeclaredSuperclass,
actual: ParentMeaning::PredicateArgument,
mismatch_code: "predicate-name-has-no-inheritance-semantics",
},
ExclusionReason {
model: CandidateModel::GenericDispatch,
required: ParentMeaning::DeclaredSuperclass,
actual: ParentMeaning::ApplicableMethod,
mismatch_code: "specificity-orders-methods-not-classes",
},
ExclusionReason {
model: CandidateModel::JvmLoaderIdentity,
required: ParentMeaning::DeclaredSuperclass,
actual: ParentMeaning::DefiningLoaderIdentity,
mismatch_code: "loader-qualifies-type-identity-not-parent-resolution",
},
]
}
pub const fn non_goals() -> &'static [NonGoal] {
&[
NonGoal {
model: CandidateModel::JavascriptPrototype,
excluded_semantics: "prototype mutation, property descriptors, private brands, and constructor/new policy",
},
NonGoal {
model: CandidateModel::LuaMetatable,
excluded_semantics: "__index traversal, metamethod invocation, and raw table access",
},
NonGoal {
model: CandidateModel::TypeclassDictionary,
excluded_semantics: "constraint inference, instance coherence, and dictionary method lookup",
},
NonGoal {
model: CandidateModel::PrologRelation,
excluded_semantics: "unification, backtracking, clauses, and relation evaluation",
},
NonGoal {
model: CandidateModel::GenericDispatch,
excluded_semantics: "method applicability, Shape specificity, method combination, and invocation",
},
NonGoal {
model: CandidateModel::JvmLoaderIdentity,
excluded_semantics: "classfile loading, verification, initialization, linking, and defining-loader namespaces",
},
]
}