From: Robert Dober Date: 2006-09-29T18:23:08+09:00 Subject: Re: New magical version of Symbol.to_proc ------=_Part_5278_8733636.1159521785230 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9/29/06, Dr Nic wrote: > > Robert Dober wrote: > > On 9/29/06, Dr Nic wrote: > [ Missing ] : Trans <...> wrote > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > >> I'll have a look at T's link but it is a truely interesting discussion= . > > You're quoting techniques need some practise! I don't think I said that > :) Indeed, indeed, I deleted the "Trans wrote", I am very bad at that, sorry for the confusion > It is for the first time that I hear that very honorable members of the > > community dislike this feature. > > For me it was the most intreaging of Ruby at all (at the beginning) > > I recall my old Python code > > > > something.get_other().do_stuff().transform() > > > > Terrible, it is only now that I realize that the concept of writing cod= e > > like this might be flawed, there are OTOH strong indications that it is > > not > > so flawed too. E.g. lots of programing conventions asking for methods t= o > > return objects. > > Now, to complicate things even more, very often that object is "self", > > personally I find the idea to return other objects, especially proxy > > objects > > to self, very intriguing, the idea came to me when I looked at the BDD > > video cast. > > In Smalltalk all methods return self unless they return something else, > thus inferring that something.get_other().do_stuff().transform() (using > Smalltalk syntax :) is common. > > In JQuery - the javascript library - everything is centered around a > "jquery" object which holds 1+ dom objects in it. All methods on the > jQuery object should return that same set of objects (via the jQuery > object container) so that you can chain method calls. > > The idea of returning a proxy object (in the Magic Dot example of > .map.lengths) was very nifty. It works the normal way AND works in the > magical way. Thx ;) credits go to BDD of course The more and more examples I see and concoct myself like this the more I > am happy to give up the core assumptions of "object oriented > programming" etc, and adopt "happy syntax programming". Syntax that > reads nicely and makes sense as to what it will do and what it will > return. You are heading for the future, I'll try to keep up with your ideas. Now if I could just get the code I originally wrote to work on > ActiveRecord associations I'd be such a happy camper. I'm in love with > that syntax. > > Nic > > -- > Posted via http://www.ruby-forum.com/. > > Robert --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_5278_8733636.1159521785230--