Hi --

On Tue, 3 Jun 2008, Gary Wright wrote:

>
> On Jun 3, 2008, at 10:42 AM, Akinori MUSHA wrote:
>> It was my assumption that was wrong.  I thought Array#collect returns
>> an object of the receiver's class so I changed it without asking, but
>> I realized it didn't.  So I reverted the change and decided to wait
>> for the discussion to reach conclusions.  That's all.  Let's keep the
>> discussion.
>
> If Array#map returns an array and Set#map returns a set, then shouldn't 
> Hash#map return a hash?

Possibly it should, but not because of Array#map or Set#map. There's
so much nuance to how all these Enumerable classes play out, in terms
of their enumerability, that I don't think a universal rule is
possible. I'm thinking of things like Range and File, as well as any
number of classes that might be written mixing in Enumerable but that
would not make sense as return values for a mapping.


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   INTRO TO RAILS         June 9-12            Berlin
   ADVANCING WITH RAILS   June 16-19           Berlin
See http://www.rubypal.com for details and updates!