Object Orientation

Parts
Class-VariantClass-Types
Friends

Class parts

Inheritance
is
True inheritance; in principle all parent classes should be concepts, because is represents a taxonomy.
All public and restricted methods/fields are passed on to the world/descendants.
Multiple occurences of a ancestor class are folded to a single occurance: this is an is-a relation, not an is-two!
wraps
Hidden inheritance; In principle all parent classes must be concrete, because wraps represents a shift of metaphore, and none of the defered methods can be implemented.
None of the the public and restricted are visible outside this wrapping class.
Multiple occurences of a ancestor class are folded to a single occurance, but for any descendents this rule no longer applies.
extends
Functional inheritance;
All public and restricted methods/fields are passed on to the world/descendants.
Multiple occurences of a ancestor class are not folded to a single occurance.

If no is, wraps, or extends class is present, 'is: Object;' is automagicaly inserted.

Convention:
Ownership
Convention:
override
This version replaces the old (existing) method
prefix
This version is called first, then the original method
suffix
The original method is called first, then this version
final
This method is defined here first, and cannot be overriden. This means that the method can be staticaly resolved.

...

Delegation
delegates
...
represents
a represents: Foo principal; is effectively has: my refer Foo principal; That means that a principal can be invalid!
If a class has multiple represents properties only one (and perhaps none) of them will be valid.
Convention:
Convention:

Class variants

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).

Class Type

Concept
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
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
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
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.

Friends

All classes in the same file are considered 'friends': they can access each others private data and methods

Constraint inheritance

require OR parent.require / ensure AND parent.ensure (qv Eifel)