DIP 1016--ref T accepts r-values--Community Review Round 1

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Jul 21 04:09:25 UTC 2018


On Friday, July 20, 2018 19:13:00 Manu via Digitalmars-d wrote:
> I can't see how this is a compelling reason to dismiss all the
> advantages of this DIP in favour of keeping the current semantic.

Honestly, I think we're just coming from points of view that are too
different. IMHO, the core use case for ref is for a function to mutate an
argument and have that result progagate to the argument, and having ref
accept rvalues is not only counter to that, but it risks bugs that are
currently impossible. I think that having a way to accept rvalues by ref for
functions where you want to avoid copying is potentially useful but not
particularly critical. On the other hand, you seem to see little or no value
in having parameters that are intended to only accept lvalues and see great
value in having functions that accept rvalues by ref in order to avoid
copying.

- Jonathan M Davis



More information about the Digitalmars-d mailing list