Advanced Computing Environment
Hosted by SourceForge
brix-os project page

Previous: Cloning ----- Up: Contents ----- Next: Prototypes


A projector maps a set of virtual slots over an object's physical set of slots. The Type type uses a projector to access properties of the represented type and Enum not only projects a slot for each group but also for the physical value slot.

  • X-body -- single or block expression

interface: (self:Self, slotname:String) -> Object
	Enum := deftype (...) {
	  slot value = ...
	  projector {
	    if slotname == "value", return self.value
	    if null? (typeOf self).groups, throw no_such_slot_error
	    each (typeOf self).groups with group ->
	      if slotname ==, return ...
	    throw no_such_slot_error

Methods and properties in the type do not see the projected slots and access the underlying slots as if there was no projection on the object. If the physical slots need to be accessed by external code then they must also be projected (like Enum) or interfaces for them implemented via properties.

Previous: Cloning ----- Up: Contents ----- Next: Prototypes