[REBOL] An object by another name
From: martin:middleton:speechworks at: 19-Feb-2002 14:52
Let's say I have the following:
car: make object! [
make: "Ford"
model: "Custom 500"
color: white
]
car1: make car [
model: "Escort"
color: red
]
car2: make car [
model: "Taurus"
color: blue
]
car3: make car [
make: "Buick"
model: "Riviera"
color: silver
]
And assume that my REBOL program asks the user the to enter a number
between 1 and 3 and that I save the response in something called car-choice.
How can I "combine" (probably a bad choice of terminology) the value "car"
and the user's response so that I end up with a value I can use to refer to
the proper object. In other words, if the user enters "2", I want to be
able to do something like:
car-chosen: car2 [I know I can't just "join" the two values to create
a pointer to car2]
so that later in the script I can refer to the variables within car-chosen as
print car-chosen/model
which should display "Taurus".
- martin