Transitioning std lib modules/packages

Andrea Fontana via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 28 01:13:54 PST 2016


On Friday, 25 November 2016 at 16:10:51 UTC, Andrei Alexandrescu 
wrote:
> * Low-tech: just use std.random_v2, std.json_v2, etc. Leave 
> std.random, std.json etc be and put them in maintenance mode. 
> Possibly deprecate them later if the v2 versions work great.
>
> * High-tech: use std.random.v2, std.json.v2, etc. This entails 
> more administrative work (convert modules to packages etc) but 
> may have some advantages due to the version being a separate 
> symbol instead of embedded in the name.

My favorite solution is the std.v2.random. Hoping std.v2.stdio 
works and it's an alias to std.stdio.

In this way it's easier to read documentation (I just need to go 
to doc/v2).

If you write a vXX for each packet we'll have:

std.v5.random
std.stdio
std.v2.json

And it's quite confusing.

IMHO:

std.v5.random
std.v5.stdio == std.stdio == std.v2.stdio == std.v3.stdio == 
std.v4.stdio
std.v5.json == std.v3.json == std.v4.json

is easier to work with (we simply choose an api level/snapshot of 
phobos).


Moreover I think that a new version of a module can have 
dependencies from another new module. I mean: std.v5.random could 
depend on std.v3.math. I'm using std.math and I'm not aware of 
this dependency and probably it is going to break something (or 
at least to generate more code than necessary).

Instead if i use std.v5.random and std.v5.math they are all on 
the same level and all dependencies should work fine.

Maybe we can define a const (just like c++) PHOBOS_API_LEVEL = XX 
we can override with a dmd flag (but set to max level inside 
phobos source) so we can avoid ugly xxx.v3.yyy names if not 
needed.

Andrea




More information about the Digitalmars-d mailing list