Const ref and rvalues again...

martin kinke at libero.it
Tue Nov 6 18:22:28 PST 2012


On Wednesday, 7 November 2012 at 01:33:49 UTC, Jonathan M Davis 
wrote:
> The most recent discussion where Walter and Andrei were part of 
> the discussion
> was here:
>
> http://forum.dlang.org/post/4F84D6DD.5090405@digitalmars.com

That thread is quite misleading and, I'm sad to say, not very 
useful (rather damaging to this discussion) in my opinion - 
especially because the distinction between rvalue => 'const ref' 
and rvalue => ref is largely neglected, and that distinction is 
of extremely high importance, I can't stress that enough. 
Walter's 3 C++ examples (2 of them invalid anyway afaik) don't 
relate to _const_ references. The implicit type conversion 
problem in that thread isn't a problem for _const_ references, 
just to point out one tiny aspect.
rvalue => ref/out propagation makes no sense imho, as does 
treating literals as lvalues (proposed by Walter iirc). The 
current 'auto ref' semantics also fail to cover the special role 
of _const_ references for rvalues (also illustrated by 
Scarecrow's post).

> Certainly, it's not a simple matter of just making const
> ref work with rvalues like most of the people coming from
> C++ want and expect.

Well I absolutely do _not_ share this point of view. It just 
seems so logical to me. I'm still waiting for a plausible 
argument to prove me wrong. All the required info is in this 
thread, e.g., we covered the escaping issue you mentioned.


More information about the Digitalmars-d mailing list