On Dec 11, 2005, at 23:45, Joshua Isom wrote:
It could be very beneficial for debugging. My debugger tends to be a
lot of print statements, so something like
.globalconst int DEBUG = 1
.macro IfDebug(level, code)
unless .level >= DEBUG goto .$endif
.code
.local $endif:
.endm
.IfDebug(1,
print "var = "
print var
)
would be useful, but nevertheless, pir statements that span multiple
lines is just weird to me. I think I'm most surprised about that. Is
it odd that I find the fact that it allows multiple lines more
surprising than allowing code?
As said, it was surprising me too. Anyway, I think typical use cases
are debugging and I prefer a solution that boils down to no code at all
for the non-debug case, like C's assert with -DNDEBUG.
With a bit of generalization we could have some -Ddefine [1] stuff that
{en,dis}ables lexing of lines within the scope of that define.
[1] -D\d+ is used for debugging, -D[a-zA-Z\w*] is still avaiable for
define (or we change current -D)
leo