ModelDriven / Alf-Reference-Implementation

Open-source implementation of the Action Language for fUML (Alf) specification.
30 stars 2 forks source link

Allow sending and accepting signals without requiring receptions #99

Closed seidewitz closed 3 years ago

seidewitz commented 3 years ago

The Alf 1.1 specification requires that a signal send target a reception (as a behavioral feature) and that the context class for an accept statement have a reception for the accepted signals. These requirements reflect similar constraints in fUML prior to fUML 1.5. However, these are purely syntactic requirements, and they do not have any effect on the underlying semantics of sending and receiving signals. fUML 1.5 now removes these constraints, but the Alf standard has not yet been updated to reflect fUML 1.5. Nevertheless, it would still be convenient to allow applications based on the Reference Implementation to have the option of allowing the sending and accepting of singles without the requirement for receptions.

seidewitz commented 3 years ago

This can be handled as follows.

  1. In FeatureReferenceImpl.deriveReferent, add to the list of referents any signals to which the feature name resolves in the current scope.

  2. Update InvocationExpressionImpl.resolveOverloading to include signals in the set of referents considered. Update selectMostSpecific so that an operation or reception is always selected over a signal with the same name and signature.

  3. Update InvocationExpressionMapping.mapTarget so that, if the referent of the invocation expression is a signal, the mapping is to a send signal action to that signal.

  4. Add the new constraint check invocationExpressionSignalReferent to InvocationExpression to disallow signals as referents of invocation expressions (this covers both FeatureInvocationExpressions and BehaviorInvocationExpressions that disambiguate to feature invocations).

  5. Separate the check for required receptions from the acceptStatementSignals constraint into a new acceptStatementReceptions constraint.

With these changes, an application using the Reference Implementation can simply ignore invocationExpressionSignalReferent and acceptStatementReception constraint violations if it wishes to allow signal sends and accept statements without requiring the use of receptions. Code that violates these constraints will still map and run correctly. Run on its own, however, the Reference Implementation will still enforce these constraints, maintaining functional consistency with the Alf 1.1 specification.

seidewitz commented 3 years ago

Resolved in v1.1.0k.