dip1000 and preview in combine to cause extra safety errors

Steven Schveighoffer schveiguy at gmail.com
Thu Jun 9 01:45:13 UTC 2022


On 6/8/22 9:27 PM, Mathias LANG wrote:
> On Thursday, 9 June 2022 at 01:18:30 UTC, Steven Schveighoffer wrote:
>>
>> 2. The programmer is *not* expecting this. They did not write `scope`, 
>> they wrote `in`, which according to the spec is "equivalent to const" 
>> (see https://dlang.org/spec/function.html#in-params). I'm convinced 
>> that we *absolutely cannot* turn on preview in by default until this 
>> is addressed. I can't even recommend using the preview switch, as this 
>> is too dangerous for memory safety.
> 
> According to the spec, `in` means `const scope` when you are using 
> `-preview=in`.

Existing code likely does not use -preview=in.

-Steve


More information about the Digitalmars-d mailing list