The name is derived from the Norse concept that the world is built on a giant tree, whose branches are so long they extend to the tree's roots. It is the brainchild of
Sean Deely Woods, and is presently implemented in
incr tcl. Any other object system could be use, or none.
The actual implementation is closer to organic chemistry than cosmology. By devising a standard set of methods and expected behaviors, one can create a way to improve how programs snap together.
Yggdrasil splits the world into 2 types of objects: Containers and Nodes.
Containers implement 2 methods:
* locate {address} - Convert a name like foo.bar.baz to a node id number
* spawn object {node_id} - Return an object handle for a node id number
Nodes are assumed to contain an internal "array" of sorts. The Get and Set functions retrieve and overwrite values from that "array".
* Get {fieldlist} - Works like array get. Return the entire internal state if fieldlist is blank
* Set {field value ...} - Works like array set.
* Links {type} - Return a list of nodes this object is linked to. If type is given, restrict the search to a certain type of link.
* References {type} - Return a list of nodes that link to this object. Note, this only covers links within the same container.
Addressing Nodes may be refered to in 4 different notations:
* container foo.bar.baz - A list of 2 elements. Element 1 is the name of a container, element 2 is a string.
* container int - A list of 2 elements. Element 1 is the name of the container. Element 2 is an integer node_id number.
* foo.bar.baz - A single string. The container is assumed to be the same as the node.
* int - An integer object number. The container is assumed to be the same as the node.
As a habit, all public facing methods should use the 2 element notation.
Link and references return data in the form of {{node_id link_name link_type} ...}
Special rules for Get and Set Get returns a {field value} list. There is a special exception for when Get is asked for a single value. In that case it returns a single value. If any value is returned as an empty list is us assumed to be NULL or does not exist.
If the value of any field in a Set command is an empty list, the object converts the value to NULL or deletes the value from a hash table.
Yggdrasil is part of the
ODIE package. More information is available at
http://www.etoyoc.com/odie