Thoughts on versioning

Dukc ajieskola at gmail.com
Thu Oct 28 15:50:28 UTC 2021


On Thursday, 28 October 2021 at 11:30:18 UTC, Ogi wrote:
> You’re saying it like it’s not a big deal but I’m afraid it’s 
> going to be a huge source of pain. Imagine not being able to 
> get some `DateTime`, or `Complex`, or `File` from one package 
> and pass it to another because one depends on `std1` and the 
> other depends on `std2`.

The packages would not be totally locked apart:
```d
auto dateTime = package1.getDateTime;
package2.useDateTime(*cast(std2.datetime.DateTime*)&dateTime);
```

This would suck of course, but at least it works. Unless the 
`DateTime` format is different between the Phobos versions, in 
which case more cowboying is needed. Preferably wrapped in a nice 
conversion function by the user.

Hopefully this would be needed only rarely. Ranges would still 
work from one Phobos to another because the DBI interface 
presumably stays the same, albeit there would be extra template 
bloat.

> Or imagine dealing with different versions of the same 
> exception class. It appears to me that versioning the standard 
> library is a bullet train straight to dependency hell.

Fortunately exceptions are all inherited from the DRuntime class, 
so at least they will have the same base class. Assuming DRuntime 
version stays coupled with compiler's.




More information about the Digitalmars-d mailing list