From: Paul Brannan Date: 2002-04-24T05:19:51+09:00 Subject: Re: building extensions-- new vs initialize On Wed, Apr 24, 2002 at 04:23:39AM +0900, Yukihiro Matsumoto wrote: > In message "Re: building extensions-- new vs initialize" > on 02/04/23, Paul Brannan writes: > |Does this apply to Ruby code or just to extensions? > > Both. Redefinition of "new" is not encouraged even in 1.6. > > |Will redefinition of "new" still work, or will I just get a warning > |message? > > They still work. But I do recommend to follow the guideline once 1.8 > is released. What can I do, then, to ensure that my extensions will work on both 1.6 and 1.8? It seems that defining only an "initialize" method would not work (since Ruby doesn't necessarily know how to correctly allocate the object), nor would defining an "allocate" method (since that won't work on 1.6). (The pickaxe book seems to indicate that defining "new" is the right way to go for 1.6; see the CDJukebox example). Paul