On Friday, 31 May 2024 at 00:56:36 UTC, Gregor Mückl wrote:
>On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:
>https://github.com/atilaneves/DIPs/blob/editions/editions.md
Destroy!
How are editions going to retain compatibility across modules with different ABIs? I believe that combinations of inheritance and interface implementations may make this quite challenging.
A probably needlessly convoluted example would be this:
- a module A, edition 2024, containing a class Foo
- a module B, edition 2024+x, containing a class Bar, and
- a module C, edition 2024+y, defining an interface IFooBar and two classes FooBar_Foo and FooBar_Bar that derive from Foo and Bar respectively, but implement the IFooBar interface on top of them.
Any function that takes a IFooBar should be able to take both implementation interchangeably. But how would this work if there was an ABI change to the class memory layout affecting Foo and Bar?
Interesting question! Given the interface ABI now (https://dlang.org/spec/abi.html#interfaces), if we don't change that all of this should work. But suppose a future edition changes the ABI for interfaces (unlikely). It would probably be complicated to implement in the compiler, but I can't see any fundamental problems there: we know what module the interface is defined in, so we know what layout to expect for any function taking one. If I'm wrong I'd love if someone educated me.
It's much more likely we change the ABI for classes in a future edition though, or the root class.