Top
Back: Debugging tools
Forward: Tracing of procedures
FastBack: Libraries
FastForward: Dynamic loading
Up: Debugging tools
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

3.9.1 ASSUME

Syntax:
ASSUME ( int_constant , expression )
Purpose:
Tests the expression for correctness if the int_constant is smaller as a variable assumeLevel. If no such variable exist the int expression is compared against 0. It is possible to define an individual assumeLevel for each library and/or procedure If the expression is evaluated and not true (i.e. does not evaluate to int(0) an error is raised.
Note: ASSUME shall be used for documentation and debugging,
production code of a library must never define assumeLevel.
Example:
 
  ASSUME(0,2==2); // always tested
  ASSUME(1,1==2); // not evaluated
  int assumeLevel=2;
  ASSUME(1,1==2);
==>    ? ASSUME failed:  ASSUME(1,1==2);
==>    ? error occurred in or before ./examples/ASSUME.sing line 4: `  ASSUME\
   (1,1==2);`
  // setting a different assumeLevel for poly.lib:
  int Poly::assumeLevel=2;
==> Poly of type 'ANY'. Trying load.
==>    ? 'Poly' no such package
==>    ? error occurred in or before ./examples/ASSUME.sing line 6: `  int Po\
   ly::assumeLevel=2;`
==>    ? wrong type declaration. type 'help int;'


Top Back: Debugging tools Forward: Tracing of procedures FastBack: Libraries FastForward: Dynamic loading Up: Debugging tools 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.