auto ref is on the docket

via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 22 06:23:46 PDT 2015


On Monday, 22 June 2015 at 04:11:41 UTC, Andrei Alexandrescu 
wrote:
> Walter and I discussed what auto ref for templates should look 
> like and reached the conclusion that an approach based on 
> lowering would be best. I added a proposed lowering to 
> https://github.com/D-Programming-Language/dmd/pull/4717.

I have to concur with Manu's statement in the PR. IMO `auto ref` 
(i.e. the status quo) is a hack introduced because of the lack of 
usable `scope`. We shouldn't spread it to other parts of the 
language, at least not for rvalue references. `scope ref` is the 
perfect fit for those.

(There may still be a use for `auto ref` with the meaning "pass 
this as efficiently as possible, I don't care whether it's a 
reference or not", but I'm not convinced of that either.)


More information about the Digitalmars-d mailing list