On 10/26/21 2:03 AM, sarn wrote:
>On Tuesday, 26 October 2021 at 01:19:29 UTC, Andrei Alexandrescu wrote:
>Goals of library versioning:
- avoid copy-and-paste code duplication across versions
This might be overengineering. Unless new features are going to be backported to the original std, is there anything wrong with just forking std to std2?
After suggesting and exploring probably 4 different mechanisms, including template mixins (which almost worked), I have come to the same conclusion. Just copy and backport fixes when needed. What you end up with if you ever did find a mechanism is subtle differences in the API/code are going to be littered with version(v2) or version(v3) or whatnot everywhere, making the code hard to follow and hard to review. You end up with the situation Walter doesn't like W.R.T. #define
s.
Those situations where the code is exactly the same are annoying to have to copy. But automation can help maintain all of that. It would be nice to focus on standardized tools that do this for you.
For cases where the original code still works exactly the same (and unfortunately in Phobos there are going to be few of these), then just public import the symbol.
-Steve