Rebol And Scopes: Well, Why Not?

I’m not sure I’ve fully understood this post… so let me ask a question to double-check my understanding: Is it correct to say that the problem with compose [interpolate (string)] is that (string) would have a different scope to [interpolate …]? With ‘definitional scoping’ that wouldn’t be an issue, since each word! can have a completely different binding, no problem. But with scopes it doesn’t work so well, since each block! can have only one scope.

If I’ve understood correctly, perhaps this might be a more immediate demonstration of the problem:

 wrapper: func [string] [
     return do compose [interpolate (string)]
 ]

 foo: func [interpolate] [
     return wrapper {Inner value: $(interpolate)}
 ]

 foo 30

In this case, compose [interpolate (string)] reduces to [interpolate {Inner value: $(interpolate)}], where the two interpolates are completely unrelated!

1 Like