-preview=in might break code

Mathias LANG geod24 at gmail.com
Sat Oct 3 16:56:06 UTC 2020


On Saturday, 3 October 2020 at 13:05:43 UTC, Andrei Alexandrescu 
wrote:
>
> [...]
>
> * This has been discussed in C++ circles a number of times, and 
> aliasing has always been a concern. If /C++/ deemed that too 
> dangerous... <insert broadside>. A much more explicit solution 
> has been implemented in 
> https://www.boost.org/doc/libs/1_66_0/libs/utility/call_traits.htm.

I don't deny that aliasing can create issues that could be very 
hard to debug.
But the problem of aliasing is not limited to `in`: code that 
uses `const ref` (or a  `const T` where `T` has indirection) can 
already misbehave if it doesn't take into account the possibility 
of parameter aliasing.

To put it differently: Why is `auto ref` acceptable but `in` is 
not ?


More information about the Digitalmars-d mailing list