From: Dr Nic Date: 2006-10-01T14:44:45+09:00 Subject: Re: New magical version of Symbol.to_proc Trans wrote: > Charles O Nutter wrote: >> The pluralization thing has too much potential for collision and looks >> jarring (to_as looks to me like "to" "as", which doesn't make any >> sense; then again I'm not a fan of programmatic pluralization for any >> reason, since it's very western-language-centric and far from >> foolproof (moose? virus? fish?)). > > You are right there. Pluralization is really going overboard, besides > the exceptions it creates a great deal of computational overhead. It > seems great on the surface, but in the end it is simply is not worth > the effort. Although it can seem odd for the English speaker at times, > Ruby's general favoring of the singular is a very good thing. And this > is one area in which I feel Rails has been unhelpful. The way I coded it, it singularizes the string and passes that as the method call for the items of the collection. So if you pass a singular method name, then it will still be singular when its passed to the children. That is: people.names returns the same list of names as people.name So non-English speakers can be happy too. Of course, if the people Array class had a name method, the latter wouldn't work. But unless you have an Array of Arrays, you won't get many name conflicts btw the Array class and the container class. Re: performance overhead - I'm not sure if the standard map+block is more or less efficient than a for-loop, but I use it anyway because my code is much more readable and writable. If I later discovered that I had a performance bottleneck near my map+blocks, then I could refactor them for speed. I don't think that in a thread on "fun syntax ideas" disapproving on the ideas based on small performance hits like "apply a gsub on a string" is much fun. :( Cheers Nic -- Posted via http://www.ruby-forum.com/.