Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: of

From: lmecir:mbox:vol:cz at: 9-Nov-2004 13:49

Anton Rolls napsal(a):
>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. >
I posted such a function called WITH once. The biggest difference is, that my function didn't return the object, I preferred it to return the result of the computation. A smaller difference is a [throw] attribute. -L