DIP 36: Rvalue References
Dicebot
m.strashun at gmail.com
Thu Apr 11 02:46:38 PDT 2013
On Thursday, 11 April 2013 at 09:27:11 UTC, kenji hara wrote:
> No. In this case, it is the purpose of 'scope ref', not is the
> implementation details.
>
> What is the language semantics and what is the implementation
> detail - that
> varies depending on what is properly supported in the language.
> D
> explicitly distinguishes lvalues and rvalues, and also defines
> that rvalue
> cannot be taken its address (== reference).
>
> The purpose of 'scope ref' is that the parameter can be
> received both
> lvalues and rvalues with one function body. To receive lvalues,
> scope ref
> should take the address of them. As a conclusion, to receive
> rvalues
> temporary creation is necessary in caller site.
>
> Yes, it mostly represents implementation details, but it is
> still
> description of language semantics.
> This confusion is almost inevitable. Because the essential
> purpose of
> 'scope ref' is already "efficiency".
>
> Furthermore, note that the desired "efficiency" is not "the
> speed of
> argument passing".
> I recognize that it is "to avoid code bloating of function
> body". If you
> need "most efficient argument passing", you should choose it
> from the
> argument type. 'scope ref' is not a thing to make the choice
> automatic.
>
> Kenji Hara
I trust your judgement then, will update DIP then. But I am still
afraid of confusion.
More information about the Digitalmars-d
mailing list