From: ES Date: 2005-05-20T01:24:29+09:00 Subject: Re: syntax sugar: treating an object like a method Austin Ziegler wrote: > On 5/18/05, ES wrote: > >>Le 18/5/2005, "Austin Ziegler" a �crit: >> >>>On 5/18/05, Eric Mahurin wrote: >>> >>>>I'm thinking of yet another RCR and would like to see if anybody >>>>likes it. I think this would be a sweet feature. Here are the >>>>basic components: >>> >>>Please don't. This would be awful. Ruby doesn't need a () >>>operator. >> >>Oh, never say never. I still fantasize about first-order >>functions/ methods (although that need would probably be better >>served by other means). For this particular purpose I would tend >>to agree, though. > > > As I understand it, Ruby already has first-order functions; they're > just not (currently) callable with foo(). Ruby 1.9 has an > experimental change that does this for local variables that have > Methods or Procs in them. First-order method meaning here that methods are just a special case of a block that has been bound to a particular object. They would be fully rebindable, copyable and assignable. Essentially, in a way, simply method dicts. > At the very least, no one has been able to explain to me why what > Ruby does isn't acceptable. I don't want or need Ruby to be Python > and I don't want or need a () operator. What Ruby does is perfectly fine. True first-order would yield some more flexibility. > -austin E -- template void quack(duck& d) { d.quack(); }