On Wednesday, 7 November 2012 at 02:58:57 UTC, Era Scarecrow
wrote:
Maybe a very simple change/addition; Like perhaps @ref?
(Attribute ref, Alternate ref, auto ref.. All sorta fit for
it's meaning).
So...
void func1(ref int x); //D lvalue-only ref
void func2(@ref int x); //works like c++'s ref
Seems fairly easy to tell apart, and still leaves const-ness as
an option.
Afaik C++ doesn't allow rvalues to be passed to _mutable_
references (T&), only to const references, making perfect sense
imo. I really do not see the point for an additional syntax for
C++-like const references (const T&) which would also take
rvalues.
Please give me an example where you want to pass an rvalue to a
_mutable_ reference parameter. I would simply continue to
disallow that, since that would mean that changes to the
referenced rvalue would not be visible for the caller (a
temporary/literal is changed - how could someone possibly want
that?).