Destructor nonsense on dlang.org

David Nadlinger see at klickverbot.at
Thu May 24 08:17:56 PDT 2012


On Thursday, 24 May 2012 at 15:04:06 UTC, Jacob Carlborg wrote:
> On 2012-05-24 16:53, Steven Schveighoffer wrote:
>> What I think we need is a dispose pattern for objects, like 
>> Tango has.
>
> Object.dispose in Tango is called on scope exit if the object 
> is variable is declared "scope". "scope" is deprecated in D2.

As for replicating that functionality, Scoped!T could always 
check for a magic dispose() method (maybe with another name, a 
marker parameter, …) and if it exists, call it on destruction.

But of course, the »universality« of the Tango runtimes 
solution is lost with this.

David


More information about the Digitalmars-d mailing list