Top
Back: reference expressions
Forward: shared expressions
FastBack: pyobject
FastForward:
Up: countedref
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.28.3 shared declarations

Syntax:
shared name = expression ;

Purpose:
defines a shared object.

Default:
None

Example:
 
system("reference"); system("shared");
  shared empty;
  empty;
==> `_`
==> 

  shared str = "Hello World!";
  str;
==> Hello World!
==> 
  shared ll= list(4, 5, 6);
  ll;
==> [1]:
==>    4
==> [2]:
==>    5
==> [3]:
==>    6
==> 
  ll[2] = str;  // change list element
  ll;
==> [1]:
==>    4
==> [2]:
==>    Hello World!
==> [3]:
==>    6
==> 


Top Back: reference expressions Forward: shared expressions FastBack: pyobject FastForward: Up: countedref Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.3.2, 2023, generated by texi2html.