In Rebol 2:
>> foo: make object! [a: 10 b: 20]
>> foo/a
== 10
>> foo/b
== 20
>> first foo
== [self a b]
>> second foo
== [make object! [
a: 10
b: 20
] 10 20]
>> third foo
== [a: 10 b: 20]
>> fourth foo
** Script Error: fourth expected series argument of type:
series date port tuple event
** Near: fourth foo
So you can pick out of it as if it were a block for values 1, 2, 3. But doing positional selection is right out in Rebol 3:
>> first foo
** Script error: cannot use pick on object! value
** Where: first
** Near: first foo
I gather that this is deprecated now (like picking out of a function to get its parameter list). However, I’m trying to translate some code that says something like:
bar: construct/with (third foo) mumble
(a) What is the point of that code?
(b) How would I translate it to Rebol 3?
a) Construct builds the object without evaluating the spec block. This implies that the spec is of
some [set-word! any-type!]form (which it would always be if you are using the body of another object). Construct/with uses a second object (mumble) as the prototype.b) Object operations appear to have changed as follows:
i)
first objectis replaced bywords-of objectii)
second objectis replaced byvalues-of objectiii)
third objectis replaced bybody-of objectorto block! objectTherefore your code can be replaced with: