Subject: MOO and debugging.

From: [email-masked]
Date: Thu, 28 Jan 1993 15:15:17 -0800

Hmmm.  Tracebacks are useful, but not ideal.  I'm constantly finding 
   myself placing debug code in my verbs to trace down problems.  Some
   sort of execution trace would be quite welcome, because places lines
   of extra code for debuging is tedious and sloppy if your forgettful and
   neglect to remove it.(as I am wont to do.)

 ______________________
| Nicholas E LaFlamme  |
|  Programmer, poet    |  Why, they come for tea, and for supper, and
|  Madman, and Vagrant.|    for you, burglar Baggins.
|______________________|               -Gandalf the Grey
 
[email-masked]
G'ran@DragonsFire Mandren@KnownSpace

---

From: [email-masked] (Erik Ostrom)
Date: Thu, 28 Jan 1993 21:58:19 -0800

WRT placing debug code in your verbs, one thing I've added to the
JaysHouseMOO core is $prog:debug--

   debug(value[, message])
   Print <value> to this, and return <value>
   If <message> is supplied, it is prepended to <value>; otherwise,
   the caller's object number is used as a prefix.

<value> can be of any type--it gets run through $string_utils:print
and then printed at the player with :tell or :notify.  This is
certainly no line-by-line (or expression-by-expression) debug mode,
but it has its advantages:

Over debug mode:
   You only pay the price of debugging where you need it.  The more I
   hear about superdebug mode on MOO-Cows, the more costly it sounds.

Over programmer:tell($string_utils:print(value)):
   It's transparent.  Because player:tell doesn't return a value, I
   found myself having to go through awkward contortions when I wanted
   to see a value that wasn't assigned to any variable, that was just
   used as part of a line.  Since :debug just returns its value, it
   can easily be inserted, like
      for object in (#73:debug(some complicated expression))
   rather than having to change to
      #73:tell(foo = some complicated expression);
      for object in (foo)
   and then back again.

   It's easy to find later on.  You mentioned neglecting to remove
   your debugging code; with a special verb reserved for debugging
   information, you can do something like
      @grep :debug( in player.owned_objects
   and find all your debug calls.

Hm, I had another advantage in mind, but I can't remember it now.
Anyway, now that I've gone and mentioned this in public, I'll probably
start working on porting it to LambdaMOO (after first checking for
:debug verbs with different purposes, etc).