rvalues -> ref (yup... again!)

Manu turkeyman at gmail.com
Wed Mar 28 18:50:06 UTC 2018


On 28 March 2018 at 05:38, Timon Gehr via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 27.03.2018 22:25, Rubn wrote:
>>
>>
>> D already has move semantics, an easy solution to this is to just use
>> another keyword. It doesn't have to bind to const ref to get what is
>> desired:
>>
>> // what was suggested in the original DIP, since scope is being used for
>> something else now
>> void foo(@temp ref value)
>> {
>> }
>>
>> Now you don't have this problem. You only get this behavior when you
>> basically say you don't care whether it is a temporary or not.
>
> Another benefit of this solution is that the overload resolution rules are
> obvious. foo(@temp ref T value) is less specialized than both foo(T value)
> and foo(ref T value).
>
> @Manu: Consider this.

This defeats the entire point to me. I want symmetrical calling code
in all cases... the current edges are a massive pain in the arse.
In the event of yet-another-attribute, then we just shift the set of
edge cases onto that attribute instead, and it makes no practical
difference in the end.


More information about the Digitalmars-d mailing list