Notes: Structs

ICI's struct type is somewhat mis-named. It is really a dictionary object. The interpreter provides syntactic sugar to make them to be used in a similar manner to C data structures, i.e, "dot-notation", however the implementation is entirely different as required by ICI's dynamic object system (ICI's dot-notation is really a shorthand for using a string object as a key in the key/value pair combination).

An ICI struct object stores zero or more key/value pairs and allows insertion and removal of new pairs. Like other ICI aggregates structs are dynamic and grow to accomondate new members. Structs are implemented as hash tables and support efficient insertion and lookup operations.

Super Structs

Structs have the concept of a super, a parent struct to which a struct is linked. When keys are looked up in the struct the search continues within the parent. This allows hierachical structures to be built and the basis for ICI's variable scope mechansism and object-oriented programming features.

The super of a struct may be specified when the object is created or may be modified at run time using the standard super() function.

Fetching from a struct using normal indexing will follow the super chain looking for the particular key. With assignments if the key/value pair found resides within a read-only (atomic) struct then rather than failing the key is used to assign into the first read/write struct in the hierarchy, this is typically the first. This may be used to implement forms of value inheritence.


Classes are similar to structs, well in fact they are structs. A class modifies the manner in which any functions defined within it are called. Instead of being called as functions they are called as method objects and have a special scope constructed for the call which includes the object instance along with its class followed by the class static scope.