Discussion: Rvalue refs and a Move construtor for D
kinke
noone at nowhere.com
Sat Sep 7 21:41:16 UTC 2019
On Saturday, 7 September 2019 at 21:09:45 UTC, Suleyman wrote:
> On Saturday, 7 September 2019 at 12:04:49 UTC, kinke wrote:
>> ```
>> void foo()(auto ref S s)
>> if (__traits(isRvalueRef, s));
>> ```
>
> This is a really just an awkward way of doing `void foo(@rvalue
> ref S s)`.
>
>> I'd prefer the latter value-view, as that's compatible with
>> current semantics.
>
> At this point you have essentially admitted rvalue ref in the
> language but you're fighting to keep it hidden from the user as
> much as possible.
Yes.
> I personally don't thing rvalue ref is that much dangerous to
> be kept away from the programmers hand. Hiding rvalue ref under
> auto ref is simply discouraging people from using it.
It's not because of dangerousness or such, but firstly because I
think pure rvalue refs (disallowing lvalue args) are used
extremely seldomly, and secondly because I want to avoid further
syntactic complexity. We have ref, auto ref, scope ref, return
ref, now we're discussing @rvalue ref...
More information about the Digitalmars-d
mailing list