据我了解,您应该能够将任何块绑定到任何上下文。特别是,您可以将全局上下文块绑定到本地上下文:
>> a: context [
print: does [rebol/words/print "yeah!"]
f: func[b] [do bind b 'print]
]
>> a/f [print "hello"]
yeah!
== "hello"
那么必须可以将本地上下文块绑定到全局上下文吗?但是我的尝试没有成功:
>> b: context [
b: [print "hello"]
print: does [rebol/words/print "yeah!"]
f: func[] [do bind b 'system]
]
>> b/b
== [print "hello"]
>> do b/b
yeah!
== "hello"
>> b/f
hello
>> do b/b
hello
看来我做到了,但是:
>> equal? bind? 'system bind? in b 'b
== false
>> same? bind? in b 'f bind? in b 'b
== true
我的错误是什么?