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

4.28.2 reference expressions

A reference expression:

  1. any identifier
  2. any subexpression of an identifier
  3. an object of type reference (result will reference the original identifier, too)


Example:
 
system("reference"); system("shared");
  int i = 17;
  reference ref = i;  // new reference
  ref;
==> 17
==> 
  reference second = ref;
  second;
==> 17
==> 
  second = 9;       // also tied to 'i'
  i;
==> 9
  typeof(ref);
==> reference

  list ll = list(1, 2, 3);
  reference lref = ll[1];
  lref;
==> 1
==> 
  lref = 12;
  ll;
==> [1]:
==>    12
==> [2]:
==>    2
==> [3]:
==>    3


Top Back: reference declarations Forward: shared declarations 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.