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: 14-Mar-2002 10:28

Specifically this is the difference...
>> source ??
??: func [ {Prints a variable name followed by its molded value. (for debugging)} 'name ][ print either word? :name [rejoin [name ": " mold name: get name]] [mold : name] :name ]
>> source probe
probe: func [ {Prints a molded, unevaluated value and returns the same value.} value ][ print mold :value :value ]
>>
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. There is an issue with paths! that occurs becuase they are processed differently than regular words somehow that prevents them from being evaluated as easily. I will leave it at that. Have fun! --Ryan [riusa--email--it] wrote: