Hi --

On Thu, 28 Sep 2006, Dr Nic wrote:

>> Actually the reason this is kind of cool is not the syntax but the
>> semantics.  It's much more expressive than any number of &:->()...
>> things that have been proposed -- and looks better.  (There may be
>> some connection there too.)
>
> Agreed - its very nice semantically too. It has much more meaning than
> .map(&:method_name) I think.
>
>> I wonder, though, whether it would be too easy for it to trample on
>> other method names.  I guess that's true of anything -- you'd just
>> have to make sure you didn't have two conceptions of some plural
>> thing.
>
> The method_missing code will perform "super" first to ensure that any
> per-existing dynamic methods on the Array are evaluated first. Then it
> attempts to call the method on the collection items. If they return a
> NoMethodError then the original error object is returned. I think that's
> cleanest.

I'm not sure that's working the way you think it is.  When you call
super in method_missing, it's calling Object#method_missing, which
really just lives to be overridden.  (Or is there some other layer
added in there somewhere?)  Also, if a dynamic method of the same name
has been defined on the array, then method_missing won't get called in
the first place :-)


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org