On 4/23/13 11:31 AM, Namespace wrote:
That's on the mark. We need to make auto ref work with non-templates
as well as templates, safely. The implementation mechanics may be
different. Lifetime of temporaries is an important detail. I discuss
such in http://d.puremagic.com/issues/show_bug.cgi?id=9238 but I never
had the time to finish it.

Andrei

3. The relationship with auto ref is insufficiently described, e.g.
there should be clarification on why auto ref cannot be improved to
fulfill the desired role.

I and probably many other have thought that auto ref cannot work for
non-templates because that would mean, that auto ref would work
differently for templates and non-templates. That was the main reason to
search for an alternative.

I recall Walter has been the first to put this forward, but has been convinced otherwise. We can make auto ref work for non-templates, even if the implementation is different. The main issues are returning ref from functions and lifetime of temporaries, as discussed in http://d.puremagic.com/issues/show_bug.cgi?id=9238.

But have you any ideas how auto ref should do this for non-templates?
E.g. with creating temporary lvalues, doubled the function etc.? That
would make it easier to support you.

There would be one implementation of the function. Binding rules, typechecking the function, and lifetime of temporaries may be changed.


Andrei

Reply via email to