Transitioning std lib modules/packages

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 25 08:10:51 PST 2016


The recent discussion about std.random suggested that we need a 
transitioning scheme for certain modules and packages in std that 
provide different designs without breaking the existing ones.

C++ has things like std::tr1 and #if __cplusplus >= 201103L. We also 
need to have separate names for modules that are redone with 
incompatible APIs, such as std.random or std.json. For a while now I was 
thinking along the lines of std.v2.random, std.v2.json etc. but that is 
misleading - it suggests the entire std has a v2 version from which we 
pick some specific modules. In reality, it's only specific modules that 
have a v2 version. So I have a low-tech idea and a high-tech one:

* 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.

So I'm leaning toward the low-tech approach unless evidence comes up 
that the other is better.

The clear message here is that we do need to make good strides toward 
replacing artifacts that need replacing without being crippled by 
backward compatibility.

So if Ilya wants to merge his random work (heh) into std, he would start 
with std.experimental.random_v2, and then upon approval move that to 
std.random_v2.


Andrei


More information about the Digitalmars-d mailing list