auto ref is on the docket
via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 23 09:37:40 PDT 2015
On Tuesday, 23 June 2015 at 12:45:25 UTC, kink wrote:
> On Tuesday, 23 June 2015 at 09:57:26 UTC, Marc Schütz wrote:
>> To guarantee this from the caller's POV, the callee must be
>> pure and the parameters must be known not to alias each other.
>
> This is obviously true. Rvalues aren't affected as they cannot
> alias another parameter by definition.
You're right, I didn't think of that! They are not _transitively_
unique, but there can indeed be no other references to the
rvalues themselves. So for rvalues, const is enough. Nice :-)
> Lvalues are if passed by ref and the same instance is
> accessible by mutable ref from another parameter or global. But
> as shown by your example, that danger is always there. The
> proposed `in` semantics make it less obvious, that's true, but
> I still think it'd be worth it, as these aliasing bugs are a
> pain to track down, but in my experience extremely rare.
More information about the Digitalmars-d
mailing list