www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - it would be helpful if packages being moved in phobos had a transition

reply singingbush <singingbush hotmail.com> writes:
When 2.099 was released `std.experimental.checkedint` became 
`std.checkedint`.

https://dlang.org/changelog/2.099.0.html

I'm happy for things to move out of `std.experimental` but I 
would love to see an improved process around it to prevent 
problems for users.

Changes like this can break tooling as well as libraries that 
need to support multiple versions of D.

For libraries published to dub repo it's worth having a fix like 
this to work around the issue:

```
     // https://dlang.org/changelog/2.099.0.html#checkedint
     static if (__VERSION__ >= 2099)
         import std.checkedint; // no longer experimental
     else
         import std.experimental.checkedint; // support older D 
front ends
```

but for tooling such as the Intellij plugin it's little more 
annoying (currently).

It would be really helpful if, when moving things out from 
`std.experimental`, that both the new and old import paths would 
work for some time as an overlap. Ideally with the older import 
path generating a deprecation warning during compile. It's 
frequent breaking changes like this that have always hindered me 
from using D in the workplace.
Oct 16 2022
next sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Sunday, 16 October 2022 at 12:04:11 UTC, singingbush wrote:
 When 2.099 was released `std.experimental.checkedint` became 
 `std.checkedint`.

 [...]
Agreed
Oct 16 2022
prev sibling parent reply Paul Backus <snarwin gmail.com> writes:
On Sunday, 16 October 2022 at 12:04:11 UTC, singingbush wrote:
 It would be really helpful if, when moving things out from 
 `std.experimental`, that both the new and old import paths 
 would work for some time as an overlap. Ideally with the older 
 import path generating a deprecation warning during compile. 
 It's frequent breaking changes like this that have always 
 hindered me from using D in the workplace.
If you had actually tested this before complaining, you would have discovered that it behaves *exactly* the way you propose. As of Phobos 2.100.2, `import std.experimental.checkedint;` still works, but prints a deprecation warning during compilation.
Oct 16 2022
next sibling parent rikki cattermole <rikki cattermole.co.nz> writes:
https://github.com/dlang/phobos/blob/master/std/experimental/checkedint.d
Oct 16 2022
prev sibling parent singingbush <singingbush hotmail.com> writes:
On Sunday, 16 October 2022 at 14:08:55 UTC, Paul Backus wrote:
 On Sunday, 16 October 2022 at 12:04:11 UTC, singingbush wrote:
 It would be really helpful if, when moving things out from 
 `std.experimental`, that both the new and old import paths 
 would work for some time as an overlap. Ideally with the older 
 import path generating a deprecation warning during compile. 
 It's frequent breaking changes like this that have always 
 hindered me from using D in the workplace.
If you had actually tested this before complaining, you would have discovered that it behaves *exactly* the way you propose. As of Phobos 2.100.2, `import std.experimental.checkedint;` still works, but prints a deprecation warning during compilation.
to be fair I didn't check it in D code as I was focusing on getting a new release of the Intellij plugin pushed to resolve the problem. The 1.28.3 release will be fix the issue and be available shortly. The way the plugin currently works it expected `/usr/include/dmd/phobos/std/experimental/checkedint.d` to exist on my system. It's not an ideal situation and certainly needs reworking but that's the way it is for now. It's good that dmd can still compile if `import std.experimental.checkedint;` is used.
Oct 16 2022