[REBOL] Re: copy with object words and values
From: allenk:powerup:au at: 15-Sep-2001 7:40
----- Original Message -----
From: "Ryan Cole" <[ryanc--iesco-dms--com]>
To: <[rebol-list--rebol--com]>
Sent: Friday, September 14, 2001 8:18 AM
Subject: [REBOL] Re: copy with object words and values
> Gregg Irwin wrote:
>
> > Ingo Hohmann wrote a couple nifty functions for retrieving the words and
> > values from an object. In his routines, he uses copy when returning the
> > data.
> >
> > ; Ingo Hohmann
> > values-of: func [
> > "Returns block of object word values next to self directive"
> > object[object!] "Object words of which its values should be
returned"
> > ][
> > copy next second object
> > ]
Have you tried?
third object
(text from http://www.rebol.com/docs/core25.html)
You can use THIRD on the object to get back a block of set-word value pairs
from the object:
z: make object! [a: 99 b: does [a + 1]]
t: third z
== [a: 99 b: func [][a + 1]]
The block returned from THIRD on an object is like an object spec block,
however the set-words are bound to their object. This block is like a
snapshot of the object's values at that time. You can also use the returned
block to set values in the object:
set first t 199
z/b
== 200
Cheers,
Allen K