Repository navigation
[Feature]: InvocationExpression::evaluate — model-level expression evaluation engine #365
Description
Description
InvocationExpressionExtensions.ComputeRedefinedEvaluateOperation(this IInvocationExpression, IElement target)
in SysML2.NET/Extend/InvocationExpressionExtensions.cs:83 is a NotSupportedException stub. It has
no OCL derivation — KerML 1.0 §8.4.4.9.8 delegates it to execution semantics:
An
InvocationExpressionevaluates to an application of itsfunctionto argument values
corresponding to the results of evaluating each of theargument Expressionsof the
InvocationExpression.
What is required
A model-level expression evaluation engine, following the pilot implementation
(org.omg.sysml.expressions → ModelLevelExpressionEvaluator).
- Library-function resolution.
ComputeResolveGlobalOperation
(SysML2.NET/Extend/NamespaceExtensions.cs:528) walks upowningNamespaceonly, so
function.qualifiedNameresolves only when the Kernel Functions Library sits in the same
containment tree as the user model.Resources/sysml.library.kparships but is loaded nowhere
outsideSysML2.NET.Kpar.Tests. Decide: SDK-side library registry, or caller-supplied library. - Dispatch registry + evaluation context.
Evaluate(IElement target)carries no parameter
binding;collect/selectre-enter evaluation once per element with a bound body parameter. - Literal factory + numeric coercion.
evaluateconstructs result elements (LiteralInteger,
LiteralRational,LiteralBoolean,LiteralString,LiteralInfinity) and promotes
Natural → Integer → Rational → Real. - The 35 library function bodies, in four groups:
- classification —
istype,hastype,@,@@,as,meta,==,!=,===,!== - boolean / control —
and,or,xor,not,implies,if,??(must not eagerly
evaluate all arguments, so these cannot share the generic dispatch path) - numeric —
+,-,*,/,%,^,<,>,<=,>=,.. - sequence —
,,#,.,collect,select
- classification —
- Fallback for a non-library function: evaluate the invoked type's result expression.
Blocked
meta and @@ need reflective metaclass features (KerML 1.0 §9.2.17) — i.e. the two remaining
Extend stubs MetadataAccessExpressionExtensions.ComputeMetaclassFeatureOperation
(SysML2.NET/Extend/MetadataAccessExpressionExtensions.cs:163) and
MetadataFeatureExtensions.ComputeSyntaxElementOperation
(SysML2.NET/Extend/MetadataFeatureExtensions.cs:208). Both require a MOF reflective registry that
does not exist in the SDK.
Depends on
#364 — dispatch keys on the same library-function set.
Checklist
- Library-function resolution strategy
- Dispatch registry + evaluation context
- Literal factory + numeric coercion helpers
- Classification functions
- Boolean / control functions
- Numeric functions
- Sequence / collection functions
- Non-library-function fallback
-
List<IElement> ComputeRedefinedEvaluateOperation(this IInvocationExpression, IElement)
System Configuration
- SysML2.NET version: 0.19.0
- Source file:
SysML2.NET/Extend/InvocationExpressionExtensions.cs
Activity