From: Trans Date: 2006-08-29T11:25:06+09:00 Subject: Re: Should Array.new(n, obj) be deprecated? Just Another Victim of the Ambient Morality wrote: > "Jason Merrill" wrote in message > news:141745d50608281759k3d61288ex3b0f8b5768ff6840@mail.gmail.com... > > It seems well known that the Array constructor form > > > > Array.new(n, obj) > > > > causes a common gotcha for programmers new to ruby (see * below for > > details). My question: is there ever any reason to use this form in > > favor of > > > > Array.new(n) {block} > > From what I've been told, there are performance trade-offs. The former > is faster than the latter so there are times when it's it's preferable if > it does the job. Otherwise, no, there's no other reason that I can tell... > Does that mean we should deprecate it? I think the pros out weigh the > cons so I don't think so... What wrong with [obj] * n T.