D Language Quarterly Meeting Summary for January 2021

Paul Backus snarwin at gmail.com
Sat Jan 22 05:43:55 UTC 2022


On Friday, 21 January 2022 at 12:33:25 UTC, Mike Parker wrote:
> ### Andrei
> Andrei brought up std.v2, but this is where memory fails me. 
> What I do recall is that there was a bit of talk about the 
> std.v2 namespace and how it will live alongside std, and this 
> came up because Robert isn't convinced the planned approach is 
> the right way to go about it. If Andrei or anyone else would 
> like to say more about what was discussed, please post 
> something below.

IMO having the `std` and `std.v2` namespaces exist alongside each 
other *in the official D distribution* would be a mistake, and 
would make the language significantly less approachable for new 
users.

New users lack the knowledge to make and informed choice between 
multiple versions of the standard library, and the skills and 
experience necessary to manage multiple versions in a single 
project. Therefore, the "out-of-the-box" experience should not 
present them with such a choice, and should not expect them to 
manage multiple versions unless they explicitly opt in to doing 
so.

Experienced D users, on the other hand, are much better equipped 
to deal with the complexities of multiple standard-library 
versions, and also much more likely to *want* to do so in the 
first place, since they may have existing projects that depend on 
older versions. In other words, they have both the means and the 
motivation to *opt in* to using multiple versions of Phobos.

The C++ standard library prioritized backwards compatibility over 
good UX, and as a result is full of "legacy" traps for unwary 
beginners, like [`std::auto_ptr`][1] and [`std::lock_guard`][2]. 
In D's standard library, we have an opportunity to learn from 
this mistake and do better. We should not let that opportunity go 
to waste.

(I think it would also be ideal if the namespace `std` were 
reserved for the latest stable release, with `std.v1`, `std.v2`, 
etc. available on an opt-in basis for users who wish to depend on 
a specific major version, but this is a much less important 
point.)

[1]: https://en.cppreference.com/w/cpp/memory/auto_ptr
[2]: https://en.cppreference.com/w/cpp/thread/lock_guard


More information about the Digitalmars-d-announce mailing list