On Jun 3, 2008, at 1:50 PM, David A. Black wrote:

> 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.


For what it's worth, in Rake, a FileList#map (and other normally array  
returning methods) will return a FileList rather than an array.  It's  
common to apply map to a list of filenames an then expect a new  
filelist as the result.  Since FileList is merely an Array with extra  
methods, this shouldn't break any code (the result of map is still a  
DuckType for an Array).

This is different than the case for Set, which changes the semantics  
of some Array methods, making it not a strict DuckType.

-- 
-- Jim Weirich
-- jim.weirich / gmail.com