There is a new implementation of FUNCTION in Rebol 3, which allows making variables automatically bound to local context by default.
FUNCTION seems to have a problem with the VALUE? test, as it returns TRUE even if a variable has not been set at runtime yet:
foo: function [] [
if value? 'bar [
print [{Before assignment, bar has a value, and it is} bar]
]
bar: 10
if value? 'bar [
print [{After assignment, bar has a value, and it is} bar]
]
]
If you call FOO you will get:
Before assignment, bar has a value, and it is none
After assignment, bar has a value, and it is 10
That is not the way FUNC works (it only says BAR has a value after the assignment). But then FUNC does not make variables automatically local.
I found the FUNCS primitive here, in a library created by Ladislav Mecir. How is it different, and does it have the same drawbacks?