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

[REBOL] Re: steel... update... of the week (for more advanced rebolers)

From: g:santilli:tiscalinet:it at: 27-Jun-2003 15:49

Hi Maxim, On Friday, June 27, 2003, 12:23:44 AM, you wrote: MOA> Its just that rebol is a little static when in comes to objects.. The problem actually is, that we have to do things differently. We continuosly try to apply "old" techniques in REBOL, and this is sometimes frustrating. Only when we realize that there's a different way, everything becomes so simple that we feel very stupid for not having thought of it the first time. :) For example, wrt face/init, it's not casual that it is a block. This way, when creating a new style from an old one, we can write: Style MyButton Button [ append init [ ; ... ] ] Who needs inheritance? MOA> I had a lot of "problems" or should I say ... issues... with MOA> objects when creating the glass dialect, and I was tired of MOA> having to re-code inits and having to call them after MOA> creating the object. That's why LAYOUT does that for you. And that's why you usually write a make-xxx function. Another approach would be that of creating a custom type and then defining your TO action for that type, so that basically you use TO instead of MAKE to create your values. (If this was supported by REBOL natively, MAKE would do it for you...) MOA> does the value at the end of "make block!" really matter i.e. MOA> could it be 1? is it similar to: [words: copy []] It doesn't, except for the fact that the interpreter won't have to reallocate the space when you'll be inserting values in it. MOA> new is sort of like "self", but on the newly allocated face, right? Exactly. MOA> I guess args points to the word block at the first argument word (ptr to a notifer, for example), If your VID code is: Text attach pipe ARGS will be set to: args: reduce ['attach pipe] That's why I used ARGS/2.
>> new/attach args/2 >> next args
MOA> and this return the list past all arguments you need... :-) Actually, one position back, because LAYOUT is already applying NEXT to the value you'll return. (This is because it is optimized for the case of facets without arguments, where you just return ARGS without having to worry about advancing it. I find this behavior a little confusing; I would change it if it wouldn't break almost every custom style out there. ;-) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: