dip1000 and preview in combine to cause extra safety errors

Steven Schveighoffer schveiguy at gmail.com
Wed Jun 8 16:22:38 UTC 2022


On 6/8/22 11:58 AM, John Colvin wrote:
> 
> The preview switch is changing the meaning of `in` which changes the 
> signature of `foo` (which is then inconsistent with the implementation), 
> which in turn will affect the call sites. This seems roughly as 
> expected, no?

I guess it is! I always thought `in` meant `const scope`, but apparently 
it no longer does unless you add `-preview=in`. However, I will note 
that just using `-preview=in` does not cause it to print the `o` 
strings, only when paired with dip1000 does it do that.

Still, I would think a warning, even for `@system` code is warranted. 
Especially since the compiler is already able to figure this out for 
`@safe` code.

The reality is that people are (mostly) only dealing with the existing 
implementation, until it stops working. But to silently break it, and 
silently break it with *memory corruption* does not seem an appropriate 
penalty.

-Steve


More information about the Digitalmars-d mailing list