D Language Quarterly Meeting Summary for January 2021
Adam Ruppe
destructionator at gmail.com
Sun Jan 23 15:55:32 UTC 2022
On Sunday, 23 January 2022 at 15:35:17 UTC, Paul Backus wrote:
> The main benefit of having multiple versions available in
> separate namespaces is that it allows them to coexist in the
> same project, which means that users can migrate their code
> incrementally from one to the other.
Yeah, I know the theory, but in practice this has limited value
and works best for more fine-grained things (e.g. keeping
deprecated individual functions around are more helpful than
whole modules).
The bigger the thing, the more likely that you'll actually
introduce more bugs and compatibility issues trying to keep both
versions working anyway.
> In principle you could also accomplish this with a versioned
> dub package and mangle-prefix [1], but progress on that
> initiative seems to have stalled out.
Well, that's because it was a hopeless idea from the beginning.
The in-language `import` doesn't know anything about mangles, so
this concept was just asking for trouble. It would work if any
only if the dependencies were *completely* isolated, but even
something as simple as you importing library A who uses v1.struct
at the same time as library B who uses v2.struct - even if lib A
and lib B's usage of that struct was entirely `private` - is
liable to cause ABI crashes. Something like PIMPL can still make
it work, but there's no guarantee they did that, and likely no
expectation that they would in typical D code.
Anyone who has debugged extern(C) crashes after a library update
knows these situations are not fun.
More information about the Digitalmars-d-announce
mailing list