Child pages
  • Cookbook - Type System

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

One other possibility to override types used by the typechecker comes with the use of node attributes. If there is a node attribute contained by the original type node, the typechecker tries to find a Substitute Type Rule applicable to the attribute first. This way one can override the type nodes even for languages, which implementation the implementation of which is sealed.

substitute type rule substituteType_SubstituteAnnotation {                                                                                       
  applicable for concept = SubstituteAnnotation as substituteAnnotation                                                                          

  substitute {                                                                                                                                        
    if (substituteAnnotation.condition.isSatisfied(attributedNode)) { 
      return substituteAnnotation.substitute; 
    } 
    null; 
  }
}                                                                                                                                                

...