Transitions to new language semantics

Dukc ajieskola at gmail.com
Fri Jun 11 11:27:20 UTC 2021


On Friday, 11 June 2021 at 07:36:47 UTC, Sönke Ludwig wrote:
> Now, what I've always thought to be the obvious solution for 
> this is to instead annotate the code on a per-module basis, 
> using UDA syntax, pragmas, or something similar. In addition to 
> avoiding import issues with external code, that would also 
> allow to upgrade large code bases on a per-module basis.

Same here. Great idea IMO. However, we have to acknowledge that 
each feature that can be enabled per-module basis needs to 
consider how old and new semantics act together. For example, if 
we want to deprecate autodecoding:

```
@semanticDisable("implicitByCodeUnit") module a;

auto foo(const char(x))
{ import std;
   return x.map!(/*...*/);
}
```

```
@semantic("implicitByCodeUnit") module b;

void main()
{ import b;
   auto var = "50€".foo; //var iterated by code unit or by code 
point?
}
```


More information about the Digitalmars-d mailing list