D Editions

Atila Neves atila.neves at gmail.com
Thu May 30 21:45:59 UTC 2024


On Thursday, 30 May 2024 at 19:36:30 UTC, bachmeier wrote:
> On Thursday, 30 May 2024 at 18:31:48 UTC, Atila Neves wrote:
>
>> The feature is meant to be backwards and forwards compatible: 
>> D modules of different editions should be able to import each 
>> other.
>
> This is critically important for editions to work, but how 
> would it be implemented? Suppose safe becomes the default in 
> the future. How would a module from a recent edition interact 
> with a module from an old edition?

In that case `@system` would be the default for the imported 
module. There are probably some cases that will be tricky, but I 
don't think this is one of them.

```
module old;
void foo() { } // no annotation so @system
```

```
module(2024) new_;
import old;
void bar() { // no annotation so @safe
     foo; // ERROR, cannot call `@system` function `foo` in 
`@safe` function `bar`.
}
```


More information about the dip.ideas mailing list