clear() and UFCS

Steven Schveighoffer schveiguy at yahoo.com
Wed May 30 05:23:45 PDT 2012


On Sat, 26 May 2012 02:31:46 -0400, Ary Manzana <ary at 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


More information about the Digitalmars-d mailing list