On Tuesday, 18 August 2015 at 14:32:18 UTC, Sergei Degtiarev wrote:
On Tuesday, 18 August 2015 at 06:52:47 UTC, Dmitry Olshansky wrote:
What I don't like is perpetual being a class - too bad as it won't honor scoping and destructor may or may not be called. Just make it a struct.
Why do you think the destructor may not be called? It is, and it syncs memory and unmaps the file. Making perpetual a struct would require implementing reference counting or disabling copying, and all such staff. In my opinion, perpetual should definitely have reference semantics, this is exactly a point where D shines.

It might be run, but there is no guarantee a class destructor will ever be called. A struct destructor will be when it goes out of scope. Hence Scoped!


http://forum.dlang.org/thread/ikuomwcxhydluojkh...@forum.dlang.org

Reply via email to