Skip to content
  Kermeta  

Aspects

Document Actions

Semantic

General : See section Weaving Kermeta code of Kermeta Manual


  • when defining an aspect on a generic class, it is forbidden to redeclare type parameters on the aspect class, even if they are strictly identical to the original class. The operations in the aspect may use the type parameters defined in the original class.
  • Merge of abstract and non abstract class is forbidden. If present in a class, the keyword may be repeated on other aspects, but even without the keyword, the clas is still abstract. If the keyword is not present in a non aspect class, then it is strictly forbidden in all corresponding aspects and the class is not abstract.
  • Merge of singleton and non singleton class is forbidden. If present, the keyword must be repeated on all aspects.
  • aspect may be used to redeclare an existing property or operation to add tags, documentation, opposite or pre and post conditions. However those redeclarations have some constraints  : for operations it is required that all the parameters stay with the same order, same type and  same name



Rationale

  • Merge of abstract and non abstract class is forbidden because it changes the contract on the class and therefore, an abstract class cannot be created using a new. Mixing that expect to be able to do a new and code that prevent it might be errorprone.
  • Redeclaration of type parameters in aspect is forbidden as it is an obstacle for class merging : merging 2 classes require that they are strictly identical to each other. If type parameters  are authorized in aspects, then they are to be taken into account for testing classes equality. If we are to take them into account, then we need to resolve their type, however type resolving requires that all classes are merged. It would not be impossible to do, but would greatly increase the complexity of merging and resolving.
  • redeclaration of operations require that parameters name stay the same because the merge of all declaration is done when calls are not yet resolved.

Open discussion

  • May be we could find some situations where we can ommit the "abstract" keyword.
  • May be we could find some situations where we can ommit the "singleton" keyword.


Planned evolution