Finalizing D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 23 07:18:25 PDT 2009


grauzone wrote:
>>>> * std.mmfile: integrate with the garbage collector. It should be there.
>>>
>>> Why should the GC know about it?
> 
> To add: in all sane situations, the mmaped region won't contain any 
> pointers, and the GC doesn't have to scan it. Allocating address space 
> is already done by the OS. Freeing the mmaped region is not the GC's 
> responsibility, but can be left to finalizers/destructors.
> 
>> Because the only way to make memory-mapped files safe is to have the 
>> GC handle them.
> 
> Care to explain?

mmhandle h = mapFile("test.txt");
char[] x = cast(char[]) h.ptr;
h.unmapFile;

Any attempt to use x will crash the program. So it's the gc who needs to 
unmap files when they are no longer referenced.

>>>> * std.outbuffer: I think this shouldn't be a class and shouldn't 
>>>> have that name.
>>>
>>> I found this class to be absolutely useless. And there isn't even 
>>> std.inbuffer! One of the crappier parts of Phobos.
>>
>> It's used in regular expressions.
> 
> Not saying the concept is useless, but the implementation. But maybe you 
> planned fixing this anyway.
> 
>>> How about giving these up to Tango? The only problem is, it has not 
>>> been ported to D2 yet.
>>
>> That's not an option.
> 
> Licensing reasons? Not-Invented-Here-Syndrome? You love reinventing the 
> wheel?

Licensing and the love for reading snickering remarks.


Andrei



More information about the Digitalmars-d mailing list