perpetual: new module for mapping file into memory

Dmitry Olshansky via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Aug 18 09:25:56 PDT 2015


On 18-Aug-2015 17:32, 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.
>

Class is allocated on GC heap dtor is called on collection in that sense 
it is a finalizer. Just use struct if you don't need inheritance and/or 
do resource management.


-- 
Dmitry Olshansky


More information about the Digitalmars-d-announce mailing list