archives

Holistic types

(This is a revision of an earlier post)

The holistic types can be used to enforce safe access
to objects in a multi-threading environment. Another
potential application is to support object swapping
between primary and secondary storage.

Objects of the holistic types cannot be accessed directly
through the references. Read and write access is only
permitted via special read/write references. Obtaining
a read/write reference implicitly locks the object.
Read/write reference cannot be stored inside an object
since the assignment would drop the read/write qualifier.
So, it is impossible to pass a read/write object reference
to another execution context (process/thread).

Type modifier for object declaration:

 holistic

It is not allowed to use a simple reference to an
object of a holistic type to read or modify its contents.
If a holistic type A refers to a non-primitive type
B then B must be holistic.

Type modifiers for reference declaration:

 read

 write

References with the resulting types are used to actually
read and modify the holistic objects.

They can be obtained through locking:

 rlock: holistic -> read

 wlock: holistic -> write

Read/write reference looses the modifier upon assignment to an object field:

 assignment to a field: read/write -> holistic

Since the read/write references cannot be stored, we
do not need to deal to circular references. This allow us
to control the scopes of locks by standard reference
counting.