[REBOL] Re: Mapping series
From: greggirwin:mindspring at: 8-Mar-2006 13:47
Hi Jeff,
JM> Thanks, I'll take a closer look at that one when I get a moment. Along the
JM> same lines, has anyone come up with a version of "gensym" that can be used?
JM> For example, using VID, I may want to dynamically create controls that
JM> access themselves. I currently don't know of a way to do this without
JM> generating a symbol to use. Here's a brief example of what I mean:
gensym: func [/with 'word /reset /local count] [
count: [0]
count/1: add 1 either reset [0] [count/1]
to word! join any [word 'g] count/1
]
Now, if you're talking about actions in faces, that's easy, because
you can just use face/<facet> in the action block. i.e. FACE in the
action block refers to the face that the action is attached to.
dyn-btn: does [
join [] ['button "foo" [face/text: "bar"]]
]
view layout dyn-btn
BTW, the above function shows the "persistent" quality of series
values in functions. In this case, it's leveraged so an enclosing
object isn't needed; sometimes it can bite you though, so you want to
use COPY most of the time when declaring local series in functions.
-- Gregg