Why in Rebol 3 the values ​​of the function parameters that are indicated in parentheses are not indicated?

The DO dialog uses a series of PAREN categories! for priority, and usually throws out the main structure of parentheses before calling the function.

However, in Rebol 2, it was possible to specify in the function definition that you want it to suppress the evaluation of parentheses on callsite. You did this using the apostrophe label "literal word" for the 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 the SERIES! type of category, 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 mistake or a focused design decision? Is there a workaround? Please note that placing a quote operator on a call site will not work, because then it is a symbolic word quote , which is quoted, and then the password! gets an estimate on its own to become the final value of the expression: - /

 >> non-evaluated quote (1 + 2) quote == 3 
+6
source share
1 answer

The behavior of this type of argument passing has been specially changed. (Many users, including me, have requested changes). The advantage is that you can request a score for this type of argument using parentheses (another way to request a score is to use get-word). If you want a truly invaluable argument passing, see This:

 quote: make function! [[ "Returns the value passed to it without evaluation." :value [any-type!] ][ :value ]] 

This is again an improvement over R2, where such a function does not behave exactly the same.

And in case you really want to transfer the guy! to your function, not wanting to change its definition in order to use a "truly unreasonable argument transition", you can try the following:

 non-evaluated (quote (1 + 2)) 
+7
source

All Articles