Const ref and rvalues again...

Era Scarecrow rtcvb32 at yahoo.com
Tue Nov 6 18:58:56 PST 2012


On Wednesday, 7 November 2012 at 02:45:15 UTC, martin wrote:
> Please discard option 1, I'm afraid it creates too much 
> confusion and was not well thought through. The objective was 
> to expand 'auto ref T' to either 'in ref T' for lvalues or 'in 
> T' for rvalues (I.e., only for const parameters!), but then its 
> caption would be horribly misleading (and something like 'in 
> auto ref' would be way too ambiguous).


  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.


More information about the Digitalmars-d mailing list