-preview=in might break code

Walter Bright newshound2 at digitalmars.com
Mon Oct 5 02:08:52 UTC 2020


On 10/3/2020 7:49 AM, Steven Schveighoffer wrote:
> `in ref` is a reference, and it's OK if we make this not a reference in 
> practice, because it's const.

No, it is not. Because a `const ref` can be changed by another mutable reference 
to the same memory object. This is defined behavior.

This suggestion turns defined behavior into implementation-defined behavior, 
meaning it will break existing code written in good faith in unpredictable, 
unreliable ways.



More information about the Digitalmars-d mailing list