Jump to content

OrdinalObjects

From WikiWorld
OrdinalObject
An object that represents itself. The object and its value are the same thing.

Stings and numbers in ObjectWiki are ordinal objects. That means they represent themselves. The Word "dog" has the value "dog". The Number 123 has the value 123.

These ordinal objects are built in to ObjectWiki. We don't need to say:

class: WikiObject
class: Word
name: dog
value: dog

since strings simply represent themselves.

Ordinal objects are immutable, they cannot be modified. If you send the message "+ 1" to the object 123, a different object, 124 is returned, the object 123 cannot be changed because it represents itself.

Note, this implies that Strings also cannot be changed. And yet, except for Symbols, which only stand for themselves, we often seek to modify Strings. In ObjectWiki, we can provide for this by defining update methods invoked on a String which will mutate the String into a Text object with an attribute value of the string which may be changed to another string (except Symbols which are Strings that forbid changes).

In ObjectWiki we make little distinction between instances, classes and meta-classes. An object can inherit from any object. In other words you can use any existing object as a model for making a new object.