Entities are those things which can exist independent of any other language construct. Their are two kinds of entities, objects (see 3. Objects) and patterns (see 4. Patterns).
An entity is comprised of five basic parts. Those parts are an access modifier, name, super type, interface types and entity value. Other less fundamental parts exists such as basic modifiers. The syntax for an entity is:
access-modifier name :super-type :interface-1, interface-2, ..., interface-n entity-value
Access modifiers are limits placed on which entities may access a given entity. For a full discussion of scoping and access modifiers see 7. Scoping. The five access modifiers are 'public
', 'scope
', 'protected
', 'private
' and 'personal
'. If the access modifier is omitted then personal access is assumed (no distinction made). Access modifiers are used only with named entities. Anonymous entities form expressions and so access modifiers are not applicable.
An entity may be named or anonymous. An entity is named if it is given a name (its entity name). An entity may be made anonymous by omitting the name. Named entities may be referred to within their context by their name. Anonymous entities cannot exist alone and are actually a form of literal expression. In addition an entity name need not always refer to the same entity. In some cases a name may refer to several different entities during the program execution, if they are all of the same type.
Note: an anonymous entity must include the first colon in its declaration to distinguish it as such.
The term overloading is used to refer to any instance where a single name may be given to multiple entities. The meaning of the name is then inferred from the context of its use. Entity overloading refers to when an entity name is overloaded to refer to both an object and pattern.
A super type indicates that the entity being declared is of the given type. That is that it has all the contents described by that type (see 5. Inheritance). A super type may be omitted. If this is the case the type Object is assumed. The difference is distinguished only for intent but doesn't change the behavior of the object in any way (see 7.2.2 Scope and 11.1 Modules). When a super type is omitted the colon introducing it is often omitted. The colon is used if and only if any of the following are true of the declaration:
An entity may be declared with zero or more interface types. An interface type indicates that the entity implements the interface of that type (see 5. Inheritance). Interface types are not as flexible as super types. Certain entities cannot have any declared interface types. Interface types are introduced by a second colon and then listed, separated by commas. The colon is omitted if no interface types are declared.
All entities have an entity value. The entity value describes the entity and determines what type of entity it is. The two basic types of entities are objects (see 3. Objects) and patterns (see 4. Patterns).