Deterministic resource freeing - delete deprecation (again)
Steven Schveighoffer
schveiguy at yahoo.com
Wed Apr 27 07:25:02 PDT 2011
On Wed, 27 Apr 2011 10:18:39 -0400, Jacob Carlborg <doob at me.com> wrote:
> On 2011-04-27 15:15, Steven Schveighoffer wrote:
>> If the Socket closes its resources in the finalizer, then use clear().
>> If the destructor does not close the resource (as could be the case if
>> the resource is GC managed), you must implement a deterministic
>> destructor member (with a different name, like close()) that you can
>> call separately from the finalizer. There is no formal design for this,
>> I really think there should be.
>
> You mean like "dispose" in Tango. That's called when "delete" or "scope"
> is used.
Yes, that is exactly what I was thinking of (couldn't think of the
name!). It's actually used I think in Java and C# as well.
-Steve
More information about the Digitalmars-d
mailing list