[1/7] 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.
[2/7] from: gabriele::colellachiara::com at: 9-Nov-2004 12:38
Hi Anton, On Tuesday, November 9, 2004, 8:30:19 AM, you wrote: AR> For the function name, I decided to avoid the word, familiar AR> to VB programmers, "WITH", because it might get confusing AR> used in (or near) the layout dialect, and it's nice and Actually, since the WITH in VID is doing basically the same thing, I'd rather call it WITH. (I have done this a couple time and called it WITH.) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[3/7] 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 [
<<quoted lines omitted: 21>>>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
[4/7] from: greggirwin:mindspring at: 9-Nov-2004 9:54
Hi Anton, I called mine WITH as well. The only difference in mine are that I check to see if the object exists and I use bind/copy. I'm an old VB guy, so it makes sense to me. :) OF doesn't read very well to me, but that's just my opinion. It saves a lot of typing no matter what you call it though. -- Gregg
[5/7] from: rotenca::telvia::it at: 9-Nov-2004 18:56
> 2) > of face [data: 3 text: "hello" edge/size: 3x3] >
Another option: do/in [data: 3 text: "hello" edge/size: 3x3] face --- Ciao Romano
[6/7] from: antonr::lexicon::net at: 10-Nov-2004 14:52
Hi Gabriele, Of course! I didn't think of that. How silly. All good comments from everyone. Anton.
[7/7] from: cyphre::seznam::cz at: 10-Nov-2004 18:01
Hi Romano, do/in would be a cool enhancement..I asked for it few years ago... Cyphre
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted