std.allocator ready for some abuse

Jakob Ovrum jakobovrum at gmail.com
Sun Oct 27 01:34:54 PDT 2013


On Sunday, 27 October 2013 at 06:15:52 UTC, Andrei Alexandrescu 
wrote:
> On 10/25/13 12:19 PM, Dmitry Olshansky wrote:
>> - I don't like the name CAllocator. Whatever that C stands for 
>> it's
>> ambiguous (Class, Cee, Caramel?).
>
> Class. Better names welcome.

I think DynamicAllocator would be a better name than CAllocator, 
but regardless, I think they're both pretty bad. However, I think 
it's indicative of a deeper problem with the interface chosen 
here: CAllocator is probably a kind of god object.

Like Dmitry, I think using `interface`s (maybe `wrap` can be 
leveraged for the adaptation role[1]) is an approach worth 
investigating. It lets the library statically enforce that it 
gets the functionality it needs as opposed to having to raise a 
runtime error, while still allowing the caller to implement that 
functionality dynamically (urgh, reaching for words!).

[1] Assuming `wrap` works on structs.


More information about the Digitalmars-d mailing list