Top
Back: python_run
Forward: reference declarations
FastBack: pyobject
FastForward: Functions and system variables
Up: Data types
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

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.

4.27.1 reference declarations  
4.27.2 reference expressions  
4.27.3 shared declarations  
4.27.4 shared expressions  
4.27.5 reference and shared operations  
4.27.6 reference and shared related functions  


Top Back: python_run Forward: reference declarations FastBack: pyobject FastForward: Functions and system variables Up: Data types Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 3-1-6, Dec 2012, generated by texi2html.