Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
language:impl [2022/05/13 08:40]
rajit
language:impl [2023/04/09 18:06] (current)
rajit [Overrides]
Line 245: Line 245:
 representation of the Boolean variable. representation of the Boolean variable.
  
 +=== Overriding conditional instances and templated types ===
  
 +An instance created in a type definition may be created only under certain circumstances. 
 +This can occur in templated types, where template parameters can affect the instances within the type.
 +The override block has the simple syntax shown above. However, to account for conditional instances,
 +the override block directives implicitly check if the instance exists before applying the override. (Note that
 +ACT does not permit different types for the same instance name under different conditions.)
  
 +When a type is being overridden by another, the new implementation may have additional template parameters.
 +The override syntax above requires the complete list of template parameters to be specified. Instead, we also
 +provide a single extension override syntax
 +
 +<code act>
 ++{
 +    type<param1,param2,...,paramN>+ id;   // single ID only
 +    ...
 + }
 +</code>
 +The ''+'' indicates that these are //extra// template parameter(s) that should be added to the existing ones that have already been specified for the instance ''id'' in the original type definition.