Home Online Manual
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

ASSUME ( int_constant , expression )
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.
  ASSUME(0,2==2); // always tested
  ASSUME(1,1==2); // not evaluated
  int assumeLevel=2;
==>    ? ASSUME failed:  ASSUME(1,1==2);
==>    ? error occurred in or before ./examples/ASSUME.sing line 4: `  ASSUME\
  // setting a different assumeLevel for poly.lib:
  int Poly::assumeLevel=2;
==> Poly of type 'ANY'. Trying load.
==> // ** redefining assumeLevel (  int Poly::assumeLevel=2;)