Language Reference/Properties

Properties are named values associated with classes and objects. Actually they are syntactic sugar for get/set predicates for the property value. And in that sense they are a language incarnation of a frequently used programming pattern.

Properties Sections
A properties section declares a set of object or class properties in the current scope.

 : class-opt properties -dot-term-list-opt

The keyword class can be used only inside class implementations, since:
 * properties declared in an interface are always object properties and
 * properties declared in a class declaration are always class properties.

Property Declaration
 :  :  -list-opt

: one of   (i) (o)

It is possible to get the value of a property that has the (o) flow, and it is possible to set the value of a property that has the (i) flow. If the flow patterns are not stated, both (i) and (o) are assumed, so it is possible bot to set and get the value of such properties.

Though it is legal to state (i) and (o) simultaneously, it is considered better practice to omit them in the get+set case.

In the sequel we will use the use the following example:

Properties are used like fact variables. It is possible to qualify properties for with a scope name or an object.

Implementation
A property is implemented by defining a function for getting the value and a predicate to set it.

Alternatively the property can be implemented as a fact variable with the same name as the property.

In this case the compiler will implicitly provide clauses that implement the get and set predicates.

It is illegal to have set and get predicates and a fact with the same name, meaning that a property is either implemented by programmer provided clauses or by a fact; mixed implementation is not possible.

As mentioned above properties are always implemented by get/set predicates even when the program implement them by a fact variable.

Properties from Interface
An interface can support a subset of another interface by stating the properties in a properties from section. The properties from section names the interface and all supported properties.

If an interface supports a subset of another interface it is neither subtype or super-type related to the other interface.

The important thing about the properties from section is that the mentioned properties retain their origin interface. Therefore:


 * there will be no support conflict with any properties from the origin interface;
 * they can be inherited as the properties from the origin interface.

 : properties from  -comma-sep-list-opt

<PropertiesFromInterface> can only be used in interface definitions.