If no is, wraps, or extends class is present, 'is: Object;' is automagicaly inserted.
class ::= class delegate ::= delegate class-variant ::= class | delegate
A delegate is just a class, but with a mandatory represents part. It also can not be called from open code, it can only be used as a delegate, so one (and exactly one) of its principals will be valid.
Interfaces and mixins are allways classes: interfaces because they have no fields, thus no principal, and mixin because it is not a delegate (and visa versa).
concept ::= concept concept-pre ::= concept [s class-variant] s identifier [s] spec [s] concept-body ::= [is | wraps | extends | delegates | represents | defers | implements | has | ]... concept-post ::= end [s concept [s identifier]] define-concept ::= concept-pre concept-body concept-post...
define concept Shape: defer: draw(); end define;
concrete ::= concrete concrete-pre ::= concrete [s class-variant] s identifier [s] spec [s] concrete-body ::= [is | wraps | extends | delegates | represents | implements | has | ]... concrete-post ::= end [s concrete [s identifier]] define-concrete ::= concrete-pre concrete-body concrete-post
A concrete class can not have any defered methods, nor can there be any defered methods from its parent(s) that it does not implements.
define concrete Sphere: is: Shape super; # A Sphere _is_ a shape implements: overide draw(); end define concrete; define concrete Star: wraps: # A Star _is_ a Sphere, but you are not Sphere shape; # supposed to move() it, scale() etc... implements: draw(); # Sphere.draw() is invisible end define concrete Star;
mixin ::= mixin mixin-pre ::= mixin s identifier [s] spec [s] concrete-body ::= [is | wraps | extends | delegates | defers | implements | has | ]... mixin-post ::= end [s mixin [s identifier]] define-mixin ::= mixin-pre mixin-body mixin-post
Mixins are a kind of concept class, which of course never represents: that would be a concept delegate. Normally other classes would extend a mixin class.
interface ::= interface interface-pre ::= interface s identifier [s] spec [s] interface-body ::= [is | defers | has ]... interface-post ::= end [s interface [s identifier]] define-interface ::= interface-pre interface-body interface-post
The has part can only have the properties.
All classes in the same file are considered 'friends': they can access each others private data and methods
require OR parent.require / ensure AND parent.ensure (qv Eifel)