Next: , Previous: , Up: Interpreters And This Library   [Index]


4.2.7 Referable Objects

Having multiple references to same piece of data, call that piece object, comes handy and at times with no alternatives. Yet, having multiple references to objects may be dubiously desirable as it makes resources management very complex.

To be useful in a application extention programming language, the references management has to come with extra assurances from the executive (the program interpreter) that the application will stay safe and tracking allocated resources, even beyond the lacks in the programming skills of those providing programs for execution.

The management of references is both time and space intensive. There are available many methods of tracking references, varying greatly in scope and performance.

The libaime provided libraries make use of a type system providing for reference tracking across data types.

The libaime referable objects type system is targeted at good performance over long program runs at the expence of short term space and time performance. For this reason the libaime type system is an immediate resource deallocation type system (there is available an alternative consolidated disposal resource deallocation mechanism, akin towards garbage disposal).

See Libraries.

See Aime Libraries.

Call referable object an object (piece of data, resource) that may be referred multiple times.

A type system is a set of conventions that some data types are observing. A referable objects type system provides the means to manage references to objects of the types observing the type system. Data of types belonging to such a type system will:

The referable objects type system in use with the libaime libraries is a reference counting based one.

Reference counting is a trivial mechanism of dealing with references. It maintains a count of the references made to some object, for each object. Each time a new reference is being added for some object, the reference count for that object is incremented. Conversely, when a reference to some object is being removed the count is decremented. When the count gets to zero there are no references to the object, and the object is good for destruction (resources allocated for that object are freeable).

Reference counting has some drawbacks, and one that makes it not quite enough for the job: it cannot deal with cycles. Cycles are here sets of objects that refer one each other, without having any reference from outside made to any of them (some say the objects belonging to the cycle can’t be reached from any given variable).

The libaime type system amends the reference counting mechanism to allow for cycles detection and destruction. It does that by maintaining an extra list of objects holding the references in excess the reference count.

The drawbacks of such reference tracking system are complexity and performance loss (both in terms of program execution speed and required memory). Still, the system provides for immediate object destruction - resources are freed as soon as no longer needed.

Definitions of referable objects data types are exchanged via the struct x1f4_nodetype_type records.

See struct x1f4_nodetype_type.

Other concerns pertaining the management of referable objects include data replication and disposal. The libaime type system provides for the protocols and the means required for the remaining management activities.


Next: Higher-order Functions, Previous: Of Errors, Up: Interpreters And This Library   [Index]