9.8 Classes

The module Class contains procedures operating on classes.

IsClass

{Class.is +X ?B}

tests whether X is a class.

new

{Class.new +ParentKs +AttrR +FeatR +PropAs ?K}

creates a new class by inheriting from ParentKs with new attributes AttrR and new features FeatR. The fields with integer features in AttrR define the free attributes. The fields with literal features define attributes with initial values, where the feature is the attribute name and the field its initial value. The semantics for FeatR is accordingly. The properties of the class to be created are defined by PropAs (a list of atoms, valid elements are sited, final, and locking).

For example, the statement

C={Class.new [D E] a(a:1 b) f(f:2 g) [final]}

is equivalent to

class C from D E 
   prop final
   attr a:1 b
   feat f:2 g
end

getAttr

{Class.getAttr +K +LI ?X}

Returns the initival value X for attribute LI as defined by the class K.

For example, the statement

{Class.getAttr class attr a:4 end a}

returns 4.


Denys Duchier, Leif Kornstaedt and Christian Schulte
Version 1.4.0 (20080702)