Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

nkuitse (193)

nkuitse
  (email not shown publicly)
http://www.nkuitse.com/

Journal of nkuitse (193)

Wednesday February 12, 2003
01:54 PM

superslotworldobjectmodel

[ #10548 ]

Consider a classless object model with these simple principles:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

A world is a collection of objects.

Each world is wholly independent from all other worlds.

Each world has a single root object.

Every object has a unique identifier (its OID).

Every object has exactly one parent, except a root object, which has none.

An object may have any number of slots.

An object inherits its parent's slots.

A root object needn't have any slots.

A slot has code.

A slot may have a parent, which is another slot.

An object has no code.

Objects receive messages.

A message has a name, arguments, and a sender.

When an object receives a message, it invokes its slot of the same name. If it has no such slot, the message is forwarded to the object's parent.

An error occurs when the root object receives a message and has no slot of the same name.

A slot may have data.

Upon being invoked, a slot may access its data.

Upon being invoked, a slot may invoke its parent, the sender of the message which resulted in the slot being invoked, or any object to which its data contains a reference.

Slots may share code.

Slots may not share data.

A slot knows of no other slot except its parent (if it has one).

Objects can't send messages, because they don't have code. Their task is simply to handle messages by finding and invoking the right slots.

A slot is given a reference to its owning object when the slot is invoked, but may not keep it (unless for some reason the slot wishes to keep the reference in its data).

An object (call it X) may be cloned to produce another object (call it B). X is then the parent of Y.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

In a nutshell: an object is simply a collection of slots, each of which may inherit from some other slot.

This is what is keeping me busy now at work. There are a few more principles (reflection, translucency, acyclicity, etc.) but this is the gist of it.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.