[REBOL] of
From: antonr::lexicon::net at: 9-Nov-2004 18:30
I just was thinking of a nice little function, OF:
of: func [
"does code in the context of the object"
obj [object!] code [block!]
][
do bind code in obj 'self
obj
]
Example:
These are equivalent
1)
face/data: 3
face/text: "hello"
face/edge/size: 3x3
2)
of face [data: 3 text: "hello" edge/size: 3x3]
For the function name, I decided to avoid the word, familiar
to VB programmers, "WITH", because it might get confusing
used in (or near) the layout dialect, and it's nice and
short. Another possible name is "DO-IN", but the longer
the word is the less chance it will actually save any
keystrokes.. :)
I wonder if anyone else made such a function or a similar
one ?
Anton.