Top
Back: 5.2.7 if
Forward: 5.2.9 quit
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.2 Control structures
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.2.8 keepring

Syntax:

keepring name ;

Purpose:

moves the specified ring to the next (upper) level. This command can only be used inside of procedures and it should be the last command before the return statement. There it provides the possibility to keep a ring which is local to the procedure (and its objects) accessible after the procedure ended without making the ring global.

Example:
 
proc P1
{
  ring r=0,x,dp;
  keepring r;
}
proc P2
{
  "inside P2: " + nameof(basering);
  P1();
  "inside P2, after call of P1: " + nameof(basering);
}
ring r1= 0,y,dp;
P2();
→ inside P2: r1
→ inside P2, after call of P1: r
"at top level: " + nameof(basering);
→ at top level: r1

See ring.


Top Back: 5.2.7 if Forward: 5.2.9 quit FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.2 Control structures Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.