Closed seidewitz closed 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.
Resolved in v1.0.5b.
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.