References in LARD

	"... he who brought the butter dish to Balshazar
	 and the tent peg to the house of Rashomon ..."
		-- Monty Python's The Meaning of Life

Version 12 brings the vicarious joy of pointers to LARD. Explicit pointer passing can sometimes be the easiest way to implement efficient parameter passing for large (multi-word) values, for passing non-storage-contiguous aggregates of values and for implementing new builtins to the LARD interpreter without writing too much icode.

In version 12 they are only used to implement refarrays. These are arrays which consist of elements which already have allocated space and need to be passed without copying. The particular application this was introduced to allow is the passing of arrays of channels into functions where those channels are declared separately and not as part of a single array.

The types ref and refarrays are defined:

	ref (T : type) : type .
	refarray (T : type, n : val(int)) : type = (ref(T) ^ n) .

Only two function exist for type ref: mkref which returns a pointer to the var argument passed to it and deref which turns a ref(T) into the value of type T which it point to.

Refarrays support two operations: refarray construction with functions of the form <_;_;...;_>, element extraction with refarray[int]. Element extraction returns a var class object. This object is a valid left hand side for assignment operations (which will affect the object to which the pointer points), can be converted to a ref(T) object by using mkref or used as a value by the implicit action of the class-conversion builtin function read.