2 Dynamically-Typed Core
--
" and extend to the end of the line or are bracketed between "(--
" and "--)
" and can be nested.
The syntax of an object declaration, excluding features relating to static type checking and modules, is as follows:[2]object
shape;object
circleisa
shape;object
rectangleisa
shape;object
rhombusisa
shape;object
squareisa
rectangle, rhombus;
object_decl ::= "object" name {relation} [field_inits] ";" relation ::= "isa" parents parents ::= named_object { "," named_object } named_object ::= name(
name
is the token for regular identifiers beginning with a letter; see appendix A.2 for more details on the lexical rules of Cecil.)
Cecil has a classless (prototype-based) object model: self-sufficient objects implement data abstractions, and objects inherit directly from other objects to share code. Cecil uses a classless model primarily because of its simplicity, but also because this avoids problems relating to first-class classes and metaclasses and because it makes defining unique named objects with specialized behavior easy. Section 2.2 shows how treating "instance" objects and "class" objects uniformly enables CLOS-style eql
specializers to be supported with no extra mechanism.
Section 2.3 describes field initializers.
Generated with Harlequin WebMaker