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

Timon Gehr timon.gehr at gmx.ch
Sat Mar 24 03:17:16 UTC 2018


On 24.03.2018 02:16, Manu wrote:
> This is an interesting point, but I don't think it changes the balance
> in any way. Thinking of the majority of my anecdotal cases, I don't
> think it would be a problem.
> Something complex enough for const to be a problem likely doesn't
> conform to this pattern.

Why aim for "it often works", when we want "it always works"? Forcing 
const upon people who want to pass rvalues by reference is just not good 
enough. It is bad language design.

Also I think the point about documenting mutation intent is moot, as 
rvalues can be receivers for method calls, which will _already_ pass an 
rvalue by reference no matter whether it intends to mutate it or not. We 
can require some special annotation for this behavior, but I'd be 
perfectly fine without it.


More information about the Digitalmars-d mailing list