EUforum Messages
- Powered by Euphoria -
Post Reply Previous Next All Messages
Date: Mon May 12 01:46
From: Derek Parnell <ddparnell at bigpo?d?com>
Subject: Re: Debug Block?

Jeremy Cowgar wrote:
> I think it's a good one.

Me too. It would be similar to the D Programming Language's facility...

 debug
 {
    ... statements  ...
 }

Some points to consider:
If we use some 'block' syntax, the block needs to be able to span routines as
well as statements, in order to comment out routines just used for debugging.
Eg.

  debug
    procedure Logger(sequence text)
      -- write text to logging file.
    end procedure
  end debug

or even ...

   debug
     include stddebug.e as dbg
     dbg:init("My App", "/var/debug.log", "append")
   end debug

If we use the line prefix style of syntax, then I suggest a double dot, which
is analogous with the double dash for comments. It also visually stands out
more.

     .. include stddebug.e as dbg
     .. dbg:init("My App", "/var/debug.log", "append")

Also, some way of turning it off/on from the command line instead of having
to edit source code, should be considered.

e.g.
   exu myapp.e --eu:debug=on

Finally, to borrow from D language, we could support debug variations.

  debug(stage1)
     dbg:log("Beginning Stage 1")
     vLimit = 1
  end debug

  debug(stage2)
     dbg:log("Beginning Stage 2")
     vLimit = 25
  end debug

and invoked by ...

   ex myapp.e --eu:debug=stage1

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

 
Post Reply Previous Next All Messages