Why doesn't Rebol 3 honor quoted function parameters that are parenthesized?

后端 未结 1 1096
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 14:11

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,

相关标签:
1条回答
  • 2020-12-09 14:35

    The behaviour of this argument passing type has been changed on purpose. (Many users including myself requested the change). The advantage is that you can request evaluation for this argument type using parentheses (another way how to request evaluation is to use get-word). If you want truly unevaluated argument passing, see this:

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

    That is again an improvement compared to R2, where such function does not really behave exactly the same way.

    And in case you really want to pass a paren! to your function while not wanting to change its definition to use "truly unevaluated argument passing" you can try this:

    non-evaluated (quote (1 + 2))
    
    0 讨论(0)
提交回复
热议问题