manual memory management

nazriel spam at dzfl.pl
Mon Jan 7 11:10:08 PST 2013


On Monday, 7 January 2013 at 17:57:49 UTC, Benjamin Thaut wrote:
> Am 07.01.2013 16:49, schrieb Gor Gyolchanyan:
>> On Mon, Jan 7, 2013 at 7:25 PM, David Nadlinger 
>> <see at klickverbot.at
>> <mailto:see at klickverbot.at>> wrote:
>>
>>    On Monday, 7 January 2013 at 15:01:27 UTC, Gor Gyolchanyan 
>> wrote:
>>
>>        How can I have an associative array, which uses a 
>> custom allocator?
>>
>>
>>    I'm afraid the only viable solution right now is to 
>> implement your
>>    own AA type as a struct with overloaded operators (which is 
>> in fact
>>    what the built-in AAs are lowered to as well).
>>
>>    There are two downside to this, though - besides, of 
>> course, the
>>    fact that you need a custom implementation:
>>      - You cannot pass your type to library functions 
>> expecting a
>>    built-in associative array.
>>      - You lose the convenient literal syntax. This could be 
>> fixed in
>>    the language, though, by providing a rewrite to a variadic
>>    constructor of user types for array/AA literals, thus 
>> eliminating
>>    the need for GC allocations (gah, another thing I just need 
>> to find
>>    the time to write up a DIP for…).
>>
>>    David
>>
>>
>> This means, that dlang.org <http://dlang.org> is lying. D 
>> doesn't
>> provide both a garbage collector and manual memory management. 
>> It
>> provides a garbage collector and a lousy excuse for manual 
>> memory
>> management. As much as I love D for it's metaprogramming and 
>> generative
>> programming, it's not even remotely fit for system-level 
>> programming the
>> way it claims it is.
>>
>> I don't mean to be trolling, but it's not the first time I got 
>> grossly
>> disappointed in D.
>>
>> --
>> Bye,
>> Gor Gyolchanyan.
>
> You can use my GC free hashmap if you want:
> https://github.com/Ingrater/druntime/blob/master/src/core/hashmap.d
>
> Kind Regards
> Benjamin Thaut

Benjamin, maybe you could in your spare time draw a DIP for 
Allocators?
This is really very important thing we need for yesterday and 
putting all the work on Andrei won't help with it.

Your solution seems to work very well in practice, maybe it would 
be possible to adapt it for Druntime/Phobos needs? Or maybe its 
already fully designed and only needs polishing and pull request?

Thanks!


More information about the Digitalmars-d mailing list