Feature #1731
Verbosity level in CoCoA5
Description
We should provide a mechanism to mimick verbosity in CoCoA-5, so that it looks similar to that in CoCoALib
Related issues
History
#1 Updated by Anna Maria Bigatti about 1 year ago
- Related to Design #1721: Verbose messages: print level? added
#2 Updated by Anna Maria Bigatti about 1 year ago
I made a test in the package monomial_ideals
.
define IsVerbosePrint(level, FnName) if VerbosityLevel() < level then return false; endif; print "[L", level, ",", FnName, "] "; return true; enddefine; -- IsVerbosePrint
then called
if IsVerbosePrint(50,"TryPrecisions") then ... endif;
We can do better than this, but it is better than before.
I should make some more experiments before taking it out for public use (interface will likely change)
#3 Updated by Anna Maria Bigatti about 1 year ago
- Target version changed from CoCoA-5.4.2 to CoCoA-5.4.4
- % Done changed from 0 to 20
#4 Updated by Anna Maria Bigatti about 1 year ago
- Status changed from New to In Progress
- Assignee set to Anna Maria Bigatti
- % Done changed from 20 to 70
New approach: easier to use, more similar to CoCoALib and sofisticated use of CoCoA-5 anonymous functions (func
) ;-)
[ is it possible also to add depth (and therefore indentation)? I don't think so :-/ ]
define IsVERBOSE_FnName(level, FnName) if VerbosityLevel() < level then return false; endif; print "[L", level, ",", FnName, "] "; return true; enddefine; -- IsVERBOSE_FnName define IsVERBOSE_func(FnName) // return func(l) return IsVERBOSE_FnName(l,FnName); endfunc; return func(l) ImportByValue FnName; if VerbosityLevel() < l then return false; endif; print "[L", l, ",", FnName, "] "; return true; endfunc; enddefine; -- IsVERBOSE_func
#5 Updated by John Abbott about 1 year ago
Not sure if it is really a good idea....
I remind you that it is possible to have global variables in packages. May this could be used to keep track of the depth?
A disadvantage is that the variable could be left with a non-zero value if the user interrupts.
Maybe indentation could be limited to 10 (or 20?), so even if a "large" value is left in the global, it won't affect too adversely the printing...
#6 Updated by John Abbott 12 months ago
Anna pointed out verbally that my idea in comment 5 (above) cannot easily be made to work, because the "depth counter" needs to be automatically incremented/decremented as functions are called/return.
I think it might be helpful to put 1 or 2 spaces at the start of each line printed as "verbose" output; this would help distinguish it from normal output (which typically does not use indentation, unless you use indent
). What do you think?
#7 Updated by Anna Maria Bigatti 12 months ago
John Abbott wrote:
I think it might be helpful to put 1 or 2 spaces at the start of each line printed as "verbose" output; this would help distinguish it from normal output (which typically does not use indentation, unless you use
indent
). What do you think?
A good idea. I made a few tests and decided for this:
2 spaces for CoCoA-5
2 spaces + depth (therefore >= 3spaces) for CoCoALib
Try this to test a rich output:
/**/ G := [x^2, x*y -z^2, y^2]; /**/ SetVerbosityLevel(90); /**/ sagbi(G);