1#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
5pub enum CandidateModel {
6 KernelClassProtocol,
7 PythonClassSpace,
8 JavascriptPrototype,
9 LuaMetatable,
10 TypeclassDictionary,
11 PrologRelation,
12 GenericDispatch,
13 JvmLoaderIdentity,
14}
15
16#[derive(Clone, Copy, Debug, Eq, PartialEq)]
18pub enum CandidateDisposition {
19 Reuse,
21 Compose,
23 Exclude,
25}
26
27#[derive(Clone, Copy, Debug, Eq, PartialEq)]
29pub enum SemanticDomain {
30 ClassProtocol,
31 ClassInheritance,
32 PropertyLookup,
33 MetamethodLookup,
34 ConstraintEvidence,
35 LogicalRelation,
36 MethodSelection,
37 RuntimeTypeIdentity,
38}
39
40#[derive(Clone, Copy, Debug, Eq, PartialEq)]
42pub enum ParentMeaning {
43 DeclaredSuperclass,
45 ProtocolReportedSuperclass,
47 PrototypeDelegate,
49 MetatableDelegate,
51 ConstraintWitness,
53 PredicateArgument,
55 ApplicableMethod,
57 DefiningLoaderIdentity,
59}
60
61#[derive(Clone, Copy, Debug, Eq, PartialEq)]
63pub struct SemanticCandidate {
64 pub model: CandidateModel,
65 pub disposition: CandidateDisposition,
66 pub domain: SemanticDomain,
67 pub declared_parent: ParentMeaning,
68 pub source_anchor: &'static str,
69}
70
71#[derive(Clone, Copy, Debug, Eq, PartialEq)]
73pub struct ExclusionReason {
74 pub model: CandidateModel,
75 pub required: ParentMeaning,
77 pub actual: ParentMeaning,
79 pub mismatch_code: &'static str,
81}
82
83#[derive(Clone, Copy, Debug, Eq, PartialEq)]
85pub struct NonGoal {
86 pub model: CandidateModel,
87 pub excluded_semantics: &'static str,
88}
89
90pub const fn candidate_inventory() -> &'static [SemanticCandidate] {
91 &[
92 SemanticCandidate {
93 model: CandidateModel::KernelClassProtocol,
94 disposition: CandidateDisposition::Reuse,
95 domain: SemanticDomain::ClassProtocol,
96 declared_parent: ParentMeaning::ProtocolReportedSuperclass,
97 source_anchor: "sim-kernel/src/class.rs",
98 },
99 SemanticCandidate {
100 model: CandidateModel::PythonClassSpace,
101 disposition: CandidateDisposition::Compose,
102 domain: SemanticDomain::ClassInheritance,
103 declared_parent: ParentMeaning::DeclaredSuperclass,
104 source_anchor: "sim-runtime/crates/sim-lib-lang-python/src/objects.rs",
105 },
106 SemanticCandidate {
107 model: CandidateModel::JavascriptPrototype,
108 disposition: CandidateDisposition::Exclude,
109 domain: SemanticDomain::PropertyLookup,
110 declared_parent: ParentMeaning::PrototypeDelegate,
111 source_anchor: "sim-runtime/crates/sim-lib-lang-javascript/src/objects/space.rs",
112 },
113 SemanticCandidate {
114 model: CandidateModel::LuaMetatable,
115 disposition: CandidateDisposition::Exclude,
116 domain: SemanticDomain::MetamethodLookup,
117 declared_parent: ParentMeaning::MetatableDelegate,
118 source_anchor: "sim-runtime/crates/sim-lib-lang-lua/src/metatable.rs",
119 },
120 SemanticCandidate {
121 model: CandidateModel::TypeclassDictionary,
122 disposition: CandidateDisposition::Exclude,
123 domain: SemanticDomain::ConstraintEvidence,
124 declared_parent: ParentMeaning::ConstraintWitness,
125 source_anchor: "sim-runtime/crates/sim-lib-lang-typed-lazy/src/runtime.rs",
126 },
127 SemanticCandidate {
128 model: CandidateModel::PrologRelation,
129 disposition: CandidateDisposition::Exclude,
130 domain: SemanticDomain::LogicalRelation,
131 declared_parent: ParentMeaning::PredicateArgument,
132 source_anchor: "sim-runtime/crates/sim-lib-lang-prolog/src/surface.rs",
133 },
134 SemanticCandidate {
135 model: CandidateModel::GenericDispatch,
136 disposition: CandidateDisposition::Exclude,
137 domain: SemanticDomain::MethodSelection,
138 declared_parent: ParentMeaning::ApplicableMethod,
139 source_anchor: "sim-runtime/crates/sim-lib-dispatch/src/method.rs",
140 },
141 SemanticCandidate {
142 model: CandidateModel::JvmLoaderIdentity,
143 disposition: CandidateDisposition::Exclude,
144 domain: SemanticDomain::RuntimeTypeIdentity,
145 declared_parent: ParentMeaning::DefiningLoaderIdentity,
146 source_anchor: "no-owner:index-and-source-inventory",
147 },
148 ]
149}
150
151pub const fn exclusion_ledger() -> &'static [ExclusionReason] {
152 &[
153 ExclusionReason {
154 model: CandidateModel::JavascriptPrototype,
155 required: ParentMeaning::DeclaredSuperclass,
156 actual: ParentMeaning::PrototypeDelegate,
157 mismatch_code: "prototype-delegates-properties-not-declared-ancestry",
158 },
159 ExclusionReason {
160 model: CandidateModel::LuaMetatable,
161 required: ParentMeaning::DeclaredSuperclass,
162 actual: ParentMeaning::MetatableDelegate,
163 mismatch_code: "metatable-delegates-operations-not-declared-ancestry",
164 },
165 ExclusionReason {
166 model: CandidateModel::TypeclassDictionary,
167 required: ParentMeaning::DeclaredSuperclass,
168 actual: ParentMeaning::ConstraintWitness,
169 mismatch_code: "dictionary-witnesses-constraint-not-subclass-edge",
170 },
171 ExclusionReason {
172 model: CandidateModel::PrologRelation,
173 required: ParentMeaning::DeclaredSuperclass,
174 actual: ParentMeaning::PredicateArgument,
175 mismatch_code: "predicate-name-has-no-inheritance-semantics",
176 },
177 ExclusionReason {
178 model: CandidateModel::GenericDispatch,
179 required: ParentMeaning::DeclaredSuperclass,
180 actual: ParentMeaning::ApplicableMethod,
181 mismatch_code: "specificity-orders-methods-not-classes",
182 },
183 ExclusionReason {
184 model: CandidateModel::JvmLoaderIdentity,
185 required: ParentMeaning::DeclaredSuperclass,
186 actual: ParentMeaning::DefiningLoaderIdentity,
187 mismatch_code: "loader-qualifies-type-identity-not-parent-resolution",
188 },
189 ]
190}
191
192pub const fn non_goals() -> &'static [NonGoal] {
193 &[
194 NonGoal {
195 model: CandidateModel::JavascriptPrototype,
196 excluded_semantics: "prototype mutation, property descriptors, private brands, and constructor/new policy",
197 },
198 NonGoal {
199 model: CandidateModel::LuaMetatable,
200 excluded_semantics: "__index traversal, metamethod invocation, and raw table access",
201 },
202 NonGoal {
203 model: CandidateModel::TypeclassDictionary,
204 excluded_semantics: "constraint inference, instance coherence, and dictionary method lookup",
205 },
206 NonGoal {
207 model: CandidateModel::PrologRelation,
208 excluded_semantics: "unification, backtracking, clauses, and relation evaluation",
209 },
210 NonGoal {
211 model: CandidateModel::GenericDispatch,
212 excluded_semantics: "method applicability, Shape specificity, method combination, and invocation",
213 },
214 NonGoal {
215 model: CandidateModel::JvmLoaderIdentity,
216 excluded_semantics: "classfile loading, verification, initialization, linking, and defining-loader namespaces",
217 },
218 ]
219}