Opened 9 years ago

Closed 8 years ago

#543 closed proposed feature (fixed)

ASSUME: define assumeLevel always; support optional error msg?

Reported by: kroeker@… Owned by: somebody
Priority: minor Milestone: Release 4-0-0
Component: singular-kernel Version: spielwiese
Keywords: ASSUME assumeLevel Cc:



  1. should the variable 'assumeLevel' always be defined?

When optionally performing integrity checks, sometimes this needs expensive additional computations which cannot be expressed in a single ASSUME statement. This computations may be performed or not depending on 'assumeLevel' Currently it is possible, that 'assumeLevel' is even not defined and this would add to the code an additional check (if (defined(assumeLevel)). Thus I propose that assumeLevel is always defined (like TRACE)

  1. If an ASSUME fails, the user has no clue what failed untils he set echo=2.

( there may be a call to a routine inside the assume statement ) Possible improvement:

option a) add 3rd parameter of type string, which is displayed if ASSUME fails

option b) display ASSUME statement code if ASSUME fails.


Change History (3)

comment:1 Changed 9 years ago by kroeker@…

another proposal:

provide MASSUME(cond, test) (or similar). The test is only performed if cond is true,

Slightly differs from ASSUME(lvl,test) where the test is only performed if assumeLevel>=lvl

Application: e.g. check the dimension of the lipmanresolve input ideal in production mode but not in development mode.

comment:2 Changed 9 years ago by kroeker@…

The initial post, part 2 is not obvious

Here is the corresponding example, where ASSUME fails but the ASSUME statement is not shown:

proc bar()
   return( "a" );

proc foo(  )
   ASSUME( 0, "b" == bar() );

results in

   ? ASSUME failed
   ? error occurred in or before ::foo line 3: `    return( "a" );    `
   ? leaving ::foo

while for

proc foo(  )
   ASSUME( 0, "b" == "a" );


we see the ASSUME statement:

   ? ASSUME failed
   ? error occurred in or before ::foo line 3: `       ASSUME( 0, "b" == "a" );`
   ? leaving ::foo

comment:3 Changed 8 years ago by hannes

Resolution: fixed
Status: newclosed

assume display a message, if it fails (see 7ea9a6cb)

Note: See TracTickets for help on using tickets.