DIP 36: Rvalue References

Dicebot m.strashun at gmail.com
Wed Apr 10 06:59:04 PDT 2013


On Wednesday, 10 April 2013 at 13:51:59 UTC, deadalnix wrote:
> It is certainly more complex on the compiler implementation 
> side. But the ends result can be much better, and any program 
> would benefit from it.
>
> Plus, do you know that depending on the ABI, some pass by value 
> are already transformed as pass by ref ? This is already in 
> place in some cases, and have been proven to work well.
>
> Back to the DIP, it fail to define how and where lvalue are 
> implicitely created, what are their lifetime, etc . . .
>
> Finally, ref and scope would benefit much more from the 
> introduction of lifetime into D than hacking around.

DIP36 was intentionally tweaked in such way so that compiler is 
free to do any implementation and swap pass by values with pass 
by ref if needed - until it preserves the semantics guarantees.

Introduction of lifetime is very beneficial but not really 
relevant to _this_ DIP. If lifetime is well defined, idea of 
making struct literal lvalues may be discussed, but that is a 
different story.

I don't care about how complex compiler implementation is but 
behavior needs to be predictable by programmer, no observable 
magic. Scope happens to have exactly the semantics needed to make 
stuff work right here and right now, with no relation to possible 
improvements of ref and rvalue/lvalue system.


More information about the Digitalmars-d mailing list