User Tools

Site Tools


Dana is structured around the use of records and micro-components (instantiated as objects) to build software. This section describes the lifecycle of these entities, including how memory is managed.


Records are used to describe data and are the fundamental way in which all memory is managed. The programmer uses variable-sized arrays to store lists of records, to create new records, and to delete old ones. The life cycle of objects is also indirectly managed by using records.

A component that needs to store instance data (such as a list of users in a chat room) will declare a record type and a variable-sized array of that type:

record ActiveUser{
   char name[];
component provides App{
   ActiveUser users[];
   int App:main(AppParam params[])
      // ...
      return 0;

This component will then add and remove elements to/from the “users” array as required. The exact data structure that is internally used to implement the array varies but the addition and removal of elements directly maps to the allocation and release of physical memory.


Objects are instantiated using the “new” notation. Objects are always stored by reference. Dana imposes strong ownership rules on objects due to its externally-managed inter-component structure. As a result, objects are destroyed when the last reference held by the creator of the object is released.

If a component needs an unknown number of objects to implement its behaviour at runtime, a variable-sized array of records is used where the record type contains an object field of the desired type.

data-lifecycle.txt · Last modified: 2014/05/16 05:33 by barryfp

Page Tools