Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Debugging [was REBOL/Zine]

From: ryanc:iesco-dms at: 13-Mar-2002 10:22

Hi! [riusa--email--it] wrote:
> Hi all, I have a problem: > > I wish to interrupt a program when it is running, using something like: > > print "DEBUG: " > ask >
You got to be careful here because 'ask takes an argument, and it will snatch one from the next line if it has to.
> At this point, I want to analyze the variables used by my software, > example: > > DEBUG: print myVar
Now 'print is one of the few functions in rebol that does not return a value, so the above line will cause an error. The functions you really want to use for debugging are '?? and 'probe. They both return their argument, so they are easy to just insert into most places. '?? is a little dum with anything except simple words, so dont use it with anything that has a "/" or a ":" in it.
> > where myVar is a variable previously defined in the software. But... > Rebol tell me the variable does not exist! I think because this break > (instruction "ask") create a new context, different from the one used > by the program while it is running. What can I do to evaluate the > instructions inserted in the "ask" block? > > Thanks! >
My guess is that the original assignment of MyVar is not being evaluated. Check that this is actually occuring with a 'probe, like so: probe MyVar: "Im evaluated!" Contexts should'nt bother you too much unless you play with to-string, context, or make object!. Enjoy! --Ryan