The DO dialect uses series of category PAREN! for precedence, and will usually boil away the underlying parentheses structure prior to invoking a function.
However, it used to be possible in Rebol 2 to specify in a function's definition that you wanted it to suppress evaluation of parentheses at the callsite. You did this by using a "literal word" apostrophe mark on a parameter:
evaluated: func [param] [probe param]
non-evaluated: func ['param] [probe param]
>> evaluated (1 + 2)
3
>> non-evaluated (1 + 2)
(1 + 2)
So you get passed a SERIES! category type, of class PAREN!...in this case with three symbolic elements inside: 1
, +
, 2
. This does not work in Rebol 3:
>> non-evaluated (1 + 2)
3
Is this a bug or a purposeful design decision? Is there a workaround? Note that putting the quote operator at a callsite won't work, because then it's the symbolic word quote
that gets quoted, and then the paren! gets evaluated on its own to become the final value of the expression :-/
>> non-evaluated quote (1 + 2)
quote
== 3
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…