In the following code, we can assign the result of a GET-WORD to p through a SET-WORD, and then use it under the new name:
p: :print
p [{Hello} {World}]
But what if you are using COMPOSE, and you find a situation such as this?
do compose [p: (:print)]
p [{Hello} {World}]
That gives an error:
*** ERROR
** Script error: -unnamed- is missing its value argument
** Where: do
** Near: do compose [p: (:print)] p ["Hello" "World"]
So it's like function values in a block are "live" when seen in the interpreter...whether they were fetched as an evaluative result or not. (It would seem they should be inert unless fetched or applied somehow, otherwise such assignments are not possible from within a COMPOSE or similar.)
It seems you have to quote a get-word, such as:
do compose [p: (quote :print)]
p [{Hello} {World}]
That could do the trick to make p the print function. But can you do it without going through a GET-WORD or similar as a proxy?
Yes, you can "disarm" the active function! value with a feature of the DO-dialect:
>> do probe compose [p: quote (:print)]
[p: quote make native! [[
"Outputs a value followed by a line break."
value [any-type!] "The value to print"
]]]
>> p [{Hello} {World}]
Hello World
They key here is the special argument passing mode used for the single argument of QUOTE:
>> source quote
quote: make function! [[
"Returns the value passed to it without evaluation."
:value [any-type!]
][
:value
]]
This argument passing mode, unimaginatively called "get arguments", inhibits evaluation of the argument value. So in our particular case, it prevents the "active" nature of the function! value to come to bear.
For more details about argument passing modes, you might want to have a look at this recent treatise about literal and get arguments, which compares the differences between Rebol 2 and Rebol 3 to give a historical perspective.