-preview=in might break code
kinke
noone at nowhere.com
Mon Oct 5 00:31:33 UTC 2020
On Sunday, 4 October 2020 at 23:40:29 UTC, Ola Fosheim Grøstad
wrote:
> It might help some if compilers would run unit tests 3 times
> with different 'in' implementations.
>
> 1 mixed value/ref
> 2 value
> 3 ref
I was about to propose something like this (restricted to POD
types), possibly augmented by some indeterministic fuzzing. Code
ported to the new `in` semantics could then even show some
previously unintended aliasing issues; getting to the root of the
problem would probably still be non-trivial though.
A compiler mode enforcing by-ref, coupled with some sort of
runtime sanitizer detecting invalid writes to live in-params,
would probably be a very valuable tool for validation &
troubleshooting.
More information about the Digitalmars-d
mailing list