DIP 1016--ref T accepts r-values--Formal Assessment
Steven Schveighoffer
schveiguy at gmail.com
Thu Jan 31 15:09:17 UTC 2019
On 1/31/19 3:25 AM, Walter Bright wrote:
> But the DIP says const ref is not required. Therefore, copying an lvalue
> to a temporary cannot be allowed, therefore implicit conversion of
> lvalues cannot happen.
The biggest reason I see to not worry about const is that we already
don't for member functions. And the world hasn't ended (yet).
>
> Then we're faced with the question of if implicit conversion of lvalues
> is not allowed, should implicit conversion of rvalues be allowed? I'm
> not so sure it should be. For one thing, a lot of people are confused
> about lvalues vs rvalues, and would find the difference in behavior
> puzzling. For another, it can complicate overloading rules. I'd say
> allowing the conversions needs a strong rationale.
We could certainly start out with no conversions allowed (except you
MUST allow conversions of compile-time data -- e.g. literals and CTFE
produced values -- that is very key), and then relax the rules later if
that's important.
-Steve
More information about the Digitalmars-d-announce
mailing list