auto ref is on the docket

via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 28 03:50:08 PDT 2015


Thank you Jonathan, I think I (like kinke in his post above) 
finally understand your stance. So I guess from your POV the 
following would be an ideal situation (disregarding the need to 
avoid breaking changes):

1) `auto ref` for non-templates is required to make a function 
accept rvalue and lvalue refs alike.
2) `auto ref` for templates is changed to mean the same thing as 
1).
3) `scope ref` prevents escaping of the reference.

Neither of `auto ref` and `scope ref` would imply the other, 
because you want to treat them as orthogonal. Do I understand you 
right?

The main problems with this is that they aren't in fact 
orthogonal: `auto ref` without `scope ref` almost only makes 
sense if you want to deliberately break something. Furthermore, 
`auto ref` is already taken for something else, and I'm not sure 
Walter would be too happy if we wanted to change its meaning for 
templates.


More information about the Digitalmars-d mailing list