Opened 9 years ago
Closed 8 years ago
#543 closed proposed feature (fixed)
ASSUME: define assumeLevel always; support optional error msg?
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | minor | Milestone: | Release 4-0-0 |
Component: | singular-kernel | Version: | spielwiese |
Keywords: | ASSUME assumeLevel | Cc: |
Description
Hello,
- 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)
- 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.
Jakob
Change History (3)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
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() ); } foo();
results in
? ASSUME failed ? error occurred in or before ::foo line 3: ` return( "a" ); ` ? leaving ::foo
while for
proc foo( ) { ASSUME( 0, "b" == "a" ); } foo()
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
Resolution: | → fixed |
---|---|
Status: | new → closed |
assume display a message, if it fails (see 7ea9a6cb)
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.