ModelDriven / Alf-Reference-Implementation

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

It should not be necessary to fully instantiate templates in order to do constraint checking #39

Closed seidewitz closed 7 years ago

seidewitz commented 7 years ago

Currently, in order to do constraint checking of a name with a template binding, the template must be fully instantiated (essentially macro expanded). If the Alf text being parsed and checked is contained within a larger model, the template instantiation then gets inserted into a namespace in the containing model, even if the Alf text has constraint violations and, therefore, is not mapped.

It would be better if constraint checking could be done using a "virtual instantiation" of the template, which would substitute template actual parameter for formal parameters dynamically as needed. The full template expansion would then only need to be done during mapping, once all constraint checks have passed.

seidewitz commented 7 years ago

Once it is no longer necessary to fully instantiate templates for constraint checking, it would also be possible to optimize the mapping of calls to collection functions, so that the underlying sequence functions are called directly, without generating a template binding at all.

seidewitz commented 7 years ago

Resolved in v1.0.5b.