On 10 April 2012 05:05, Jason House <[email protected]> wrote: > On Apr 9, 2012, at 10:46 PM, Andrei Alexandrescu <[email protected]> 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.
I haven't seen any longer explanation, either. We seem to be in a situation where there's a problem, the only known 'solution' (from C++) has been rejected, but without a replacement. For nearly two years it has been one of the top items on my list of outstanding compiler and language issues: http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel#DMDCompilerStability It needs considerable thought, and a complete description of what's wrong with the C++ approach seems to be a necessary and useful step. BUT... I don't think we should be trying to solve this difficult issue right now, while we are trying to get a release out the door. _______________________________________________ dmd-beta mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-beta
