The following message is a courtesy copy of an article
that has been posted to comp.lang.misc as well.

Dave Thomas <Dave / Thomases.com> writes:

|> For example, `new' of Array class uses its argument to determine
|> allocation size of internal buffer.  Calling `initialize' in the
|> method is useless, because meaning of an argument is already fixed.
|
|If we take Array as an example, why can't the internal 'new' method do
|the allocation, and then call .initialize with the parameters. Agreed,
|there's no allocation that .initialize can do, but it might still be
|interested in the arguments anyway.

`initialize' trick requires two things:

  * `new' accepts arbtrary number of arguments
  * `new' does not use arguments to allocate object,
    just pass to `initialize'

Array.new does not qualify both.  Possible workaround is to allocate
default sized array at first, then resize it in Array#initialize.  
I'm not sure how serious performance overhead should be.

Since most array allocation is done by array expression, not
Array.new, performance penalty might be minimum.

							matz.