Closed jjsullivan5196 closed 3 months ago
Binding in Ren-C is radically different...
All source material is unbound by default, and binding propagates as a wave. Under EVAL, a plain WORD! will pick up the binding that is propagating... so will a SET-WORD!. But all quoted material merely drops the quote under evaluation, and does not add the binding.
Blocks act in a similar way. So a block does "evaluate", it just evaluates to a bound version of itself...if it doesn't already have a binding. Given that universal rule about quoted material not affecting binding, it means [print "Hi"] and '[print "Hi"] are different:
>> code: [print "Hi"]
== [print "Hi"]
>> eval code
"Hi"
>> code: '[print "Hi"]
== [print "Hi"]
>> eval code
** Script Error: print word is not bound to a context
If you want a variant of "quoting" that can be used with evaluation, you need to use a VAR-WORD!
>> foo: 10
== 10
>> $foo
== foo
>> set? $foo
== ~true~ ; anti
>> get $foo
== 10
The thought process that went into designing this is laid out in the post "Rebol and Scopes: Well, Why Not?"
https://forum.rebol.info/t/rebol-and-scopes-well-why-not/1751
It's a time of transition as this new way of thinking takes shape! But it's much better than historical Rebol's chaotic "painting bindings on everything by deep walks", because that generated tons of meaningless bindings.
Thanks for the clarification @hostilefork
In the r3 console on https://github.com/metaeducation/ren-c/commit/70d066816ad705ca489c79b3aa9609e777b7b9cf
try
doesn't fix it eithertrap
is the same