Question about Array.new(ary)

ts wrote:

> In any case this is a slippery slope I don't think Ruby should

have

> ever started down.

I hope that you know this ?

uln% ruby -e 'class A; def to_int() 12 end; end; p Array.new(A.new)'
[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
uln%

--

Guy Decoux

I guess you're merely pointing out what Linus Sellberg mentioned. Yes,
I'm aware that if the first argument is an integer, the behavior is
different.

I'm only talking about the behavior of Array.new where the first
argument is an Array. It should be removed IMHO. It should strictly
be:

Array.new(size,obj=nil)
Array.new(size,obj=nil){ ... }

Mind you, I wouldn't mind seeing the block form removed, but I think
I'm outvoted there.

Regards,

Dan