[dmd-beta] D 2.059 beta 4

Jason House jason.james.house at gmail.com
Mon Apr 9 20:05:04 PDT 2012


On Apr 9, 2012, at 10:46 PM, Andrei Alexandrescu <andrei at erdani.com> wrote:

> On 4/9/12 9:42 PM, Jason House wrote:
>> From a safety perspective, passing strict literals as "const ref" is
>> fine. There is no output to discard. I have a vague impression that
>> the restriction was put in place to allow some kind of optimization.
>> I bet it's discussed in TDPL somewhere...
> 
> Rvalues masquerading as references to constant values have caused enormous harm to C++, culminating in the "fix" that was rvalue references.
> 
> Let's not repeat that values. Rvalues are rvalues and should stay that way.

I have never seen an explanation of D's  lack of rvalue references longer than this. Is there any online explanation/blog describing how this neatly avoids the need for the solution from C++? There has to be more to it than just creating a temporary variable when the compiler issues an error.


More information about the dmd-beta mailing list