May 30, 2012 Re: clear() and UFCS | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Manzana | On Sat, 26 May 2012 02:31:46 -0400, Ary Manzana <ary@esperanto.org.ar> wrote: > On 5/25/12 22:42 , Steven Schveighoffer wrote: >> Finalize isn't right, and neither is dispose... > > In Java it's finalize: > > http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#finalize() No, this is the GC finalizer. This is equivalent to D's class destructor. We need a function name that denotes *deterministic* destruction. > In Ruby it's define_finalizer: > > http://www.ruby-doc.org/core-1.9.3/ObjectSpace.html#method-c-define_finalizer I don't know enough about Ruby to comment, but is this called by the GC? It seems like it is. > Why not calling finalize then? A bonus is that programmers coming from those languages will find the name more intuitive. Actually, they will find it confusing, since it doesn't do the same thing. -Steve |
Copyright © 1999-2021 by the D Language Foundation