Hi --

On Fri, 10 Dec 2004, trans.  (T. Onoma) wrote:

> Hi--
>
> On Thursday 09 December 2004 08:17 pm, David A. Black wrote:
> | I would just as soon have things remain as they are (with the possible
> | exception of making String#delete destructive; I think it's the only
> | one that isn't).  But if Matz chooses to revisit this area, I would
> | not want to see "compact" become a general-purpose method for removing
> | elements.  [1,2,3,4].compact(3)  just doesn't communicate anything
> | along the lines of [1,2,4].
> |
>
> I wouldn't say it doesn't communicate anything at all. Compact does make one
> think it will be getting smaller. But I take you point, yet isn't it kind of
> silly to have two methods such that one of them is just a very limited case
> of the other?

I don't think that's all there is to it.  The presence of unwanted
nils in arrays is very common, because arrays serve as the receptacle
for operations like map and scan.  So having a method dedicated to
that doesn't seem silly to me at all, and it gets used a lot.  There's
no iron-clad, slam-dunk necessity for it, I guess, but I personally
think it's a good illustration of the kind of balance (as opposed to
symmetry, which is a different thing) that Matz is so good at
crafting.


David

-- 
David A. Black
dblack / wobblini.net