Phobos addition formal review: std.experimental.allocator

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 23 02:18:37 PDT 2015


On Monday, 22 June 2015 at 22:38:19 UTC, Andrei Alexandrescu 
wrote:
> Perhaps I misunderstood the request - currently the imports in 
> allocator/package.d are:
>
> public import std.experimental.allocator.common,
>     std.experimental.allocator.typed;
> import std.algorithm, std.conv, std.exception, std.range, 
> std.traits,
>     std.typecons, std.typetuple;
> version(unittest) import std.random, std.stdio;
>
> Is that okay, and if not what should change?

My concern was about the fact that symbols `IAllocator`, 
`theAllocator`, `processAllocator` and bunch of others are 
defined within `package.d` itself and not provided via public 
import. That means that anyone willing to change default 
allocator or use `make` MUST import all std.allocator modules 
even if nothing else is really needed (those utilities look very 
independent). Which means processing bunch of unnecessary imports 
- and more of those if more modules will get added to the package.

I'd prefer to have a small dedicated module, i.e. 
`std.allocator.api` (not going to discuss names!) and do public 
import of it from `std.allocator.package.d`. Makes sense?


More information about the Digitalmars-d mailing list