を単語をバインドするbind/new
を使用することです:
>> get to-word (rejoin [foo "_result_data"])
== [none none none none none]
を
REBOL 3は、REBOL 2とは異なるコンテキストを扱います。新しい単語を作成するときは、明示的にコンテキストを処理する必要があります。そうでなければコンテキストがなくなり、設定しようとするとエラーが発生します。これは、デフォルトで単語のコンテキストを設定するREBOL 2とは対照的です。
だから、同じようREBOL 3のコードを使用して検討することもでき、あなたの動的変数GET /設定します
; An object, providing the context for the new variables.
obj: object []
; Name the new variable.
foo: "test1"
var: to-word (rejoin [foo "_result_data"])
; Add a new word to the object, with the same name as the variable.
append obj :var
; Get the word from the object (it is bound to it's context)
bound-var: in obj :var
; You can now set it
set :bound-var now
; And get it.
print ["Value of " :var " is " mold get :bound-var]
; And get a list of your dynamic variables.
print ["My variables:" mold words-of obj]
; Show the object.
?? obj
をスクリプト利回りとしてこれを実行:
Value of test1_result_data is 23-Aug-2013/16:34:43+10:00
My variables: [test1_result_data]
obj: make object! [
test1_result_data: 23-Aug-2013/16:34:43+10:00
]
代替をして上で使用しますBINDを使用していた可能性があります:
bound-var: bind :var obj
バー。今私はそれを見ることが明らかです。ありがとうございました。 :) –