std.allocator ready for some abuse

deadalnix deadalnix at gmail.com
Thu Oct 24 16:22:17 PDT 2013


On Thursday, 24 October 2013 at 19:53:56 UTC, Andrei Alexandrescu 
wrote:
> Hello,
>
>
> I know it's been a long wait. Hopefully it was worth it. The 
> alpha release of untyped allocators is ready for tire-kicking 
> and a test drive.
>
> Code: 
> https://github.com/andralex/phobos/blob/allocator/std/allocator.d
>
> Dox: http://erdani.com/d/phobos-prerelease/std_allocator.html
>
> Warning: this is alpha quality. Unit tests are thin, and there 
> are no benchmarks. Both would be appreciated, particularly 
> benchmarks to validate the gains (which I speculate can be very 
> sizable) of custom-built, special-purpose allocators compared 
> to traditional allocators.
>
> I acknowledge I'm clearly in no position to evaluate this 
> design. I have been knocking around it for long enough to have 
> no idea how easy it is to get into it from the outside, or how 
> good it is. By all signs I could gather this feels like good 
> design, and one of the best I've ever put together. The 
> allocators defined have an archetypal feeling, are flexible 
> both statically and dynamically, and morph and combine in 
> infinite ways.
>
> CAllocator and CAllocatorImpl make the link between the static 
> and dynamic worlds. Once an allocator is assembled out of 
> pieces and finely tuned, wrapping it in a dynamic API is a snap.
>
> Please destroy! I've literally sweat as I'm sending this :o).
>
>
> Andrei

First, I love it !

Now destroying :D

The first thing I notice is that this module is dead unsafe. I'm 
not sure it belong to std. We should probably reserve that for a 
"guru" part of the standard lib. Putting some system function in 
the standard lib is OK, as they are packaged around concepts 
(range, array, algorithms, etc . . .) but an entire module 
dedicated to @system stuff seems like it belong to another place.

I see that you did update the whole stuff according to previous 
discussion, and I'm not sure I have something against the design 
anymore :D

Now, typed allocators, generic tail const and we can get awesome 
collections!


More information about the Digitalmars-d mailing list