-preview=in might break code

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Oct 3 15:30:27 UTC 2020


On Saturday, 3 October 2020 at 14:49:03 UTC, 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. And code that takes 
> something via `in ref` can already expect possible changes via 
> other references, but should be OK if it doesn't change also.

You either support aliasing or not.

If you support aliasing then you should be able to write code 
where aliasing has the expected outcome.

Let me refer to ADA. According to the ADA manual you can specify 
that an integer is aliased, that means that it is guaranteed to 
exist in memory (and not in a register). Then you use 'access' to 
reference it.

If a language construct says "ref" I would expect 100% support 
for aliasing. It is not like aliasing is always undesired.



More information about the Digitalmars-d mailing list