ObjectModel

 Edit this page
This page is the current proposal for Wheat's object model. Other content from this page has been moved to: ObjectModelIssues, ObjectModelDiscussion, ObjectIssues, XmlInterchange, MemoryModelRelatedWork and DataBaseIntegration.

Wheat is object pure. Everything is an object from the lowliest number to the biggest web site.

Wheat's objects are prototype based. That is, while they inherit from some object acting as a class, any object can serve as the class of another, and any object can have customized fields and methods.

Properties

Objects consist of properties, which are a mapping from names to values. The names of an objects properties are unique within the object.

Each property has aset of AccessFlags that determine which other objects can access the property, if they can write it, and how the property is inherited.

Inheritance

An object in Wheat can inherit from another object. The inheriting object is called the child, and the object inherited from called the parent. Of course, the parent object itself may have a parent. The chain of parents of an object are called its ancestors.

When a property of an object is referenced, if the object doesn't directly contain it, then the ancestors are searched, starting with the parent. During this search, only properties with the i access flag are matched. From the point of view of the user of an object, an inherited property (found via ancestor search) is indistinguishable from one that is part of the object.

Objects indicated that they have a parent by having a property with the name parent. The parent property is a link to the parent object. It is always a link.

Home and Object Identity

Every object in Wheat has a home. The home of an object is where it lives and can be said to be contained within it. If an object is destroyed, then all the contained objects in it (recursively) are also destroyed.

This implies that many objects that are singletons in other languages (numbers, strings, boolean values) are not in Wheat. Every time the number 42 appears in a Wheat object, it is a different 42.

It is non-sensical to ask if two objects are the same object - they can't be. It is sensical to ask if two links refer to the same name (with various levels of resolution). See LinkSemantics & ObjectNameSpace.

Objects all have two properties related to home. The home property is a link the object's home. The id property is the key in the home where this object can be found. If the home is a normal Wheat object, then this is the name of the property that contains this object. In some cases, the id may be an integer.

(Related keywords: heap, symlink, malloc, allocation, extent, object lifetime.)

Array Objects

There is one special class of objects in Wheat called arrays. Arrays store an ordered sequence of values, indexed by integers, starting at 0.

Object Store

Note that the concept of object store has been factored out in Wheat. Objects are stored in one of several different ObjectMedia, which have differing storage semantics.
There is no comment on this page. [Display comments/form]