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

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

From: ingo::2b1::de at: 15-Mar-2002 0:11

Hi Ryan, Ryan Cole wrote: <...>
> So one difference is probe evaluates its argument, whereas > ?? captures the argument without evaluation and attempts to > print its word along with its value. The little tick mark does in > ??'s function spec grabs a value without evaluating it like normal. > > A common example... > >>>?? b: 5 >> > b: > == 5 > >>>probe b: 5 >> > 5 > == 5 > > As you see ?? printed out the set-word! b: and returned 5, where > probe printed 5 and returned 5. This suprise result that happens with > ?? occurs becuase it the set-word b action does not happen until after ?? > has returned its value--which is the set-word b.
This discription is a little bit misleading: in the case of '?? b: is printed, but 5 isn't returned by '??, 5 is returned because it didn't get eaten, and was the last value on the line, as can be seen in this extended example.
>> b
** Script Error: b has no value ** Near: b
>> ?? b: 7
b: == 7
>> b
** Script Error: b has no value ** Near: b
>> probe b: 7
7 == 7
>> b
== 7
>> ?? b:
b: == b:
>> ?? b
b: 7 == 7 So, 'probe can be used to print the value of _any_ expression, '?? normally only makes sense with words, but you get the added benefit of being told the name of the word. Kind regards, Ingo