4.27 reference and shared (experimental)
The black box data types reference and shared in SINGULAR
allow for concurrently accessing SINGULAR object data.
Copying such object will only add an additional handle which allows you
to define multiple identifers for the same object instance.
Both experimental features are hidden by default, please activate them by
typing system("reference"); or system("shared"); , respectively,
at the SINGULAR prompt.
You must initialize a reference using a named identifier
or a subexpression of the latter. The resulting object can be stored to gain
read and write access from sophisticated data structures.
In contrast, the type shared can be used to
avoid the initial identifier definition. Each copy has equal rights
for manipulating the data.
In most cases the value look-up is done automatically, but sometimes
you have to disambiguate the input.
The previous example had shown that reference and shared
objects can store highly structured without duplicating data
all over again.
As an additional feature, you can use reference objects for
implementing procedures having side-effects.
If you do not need write-access to proc parameters, your code
will usually perform better using the alias statement in the
parameter list, see proc.
|