Current version of D.
Jonathan M Davis
jmdavisProg at gmx.com
Sat Jul 6 02:58:12 PDT 2013
On Saturday, July 06, 2013 11:44:43 TommiT wrote:
> On Saturday, 6 July 2013 at 08:14:06 UTC, Jonathan M Davis wrote:
> > Ah, there's also auto ref. The way TDPL describes it, it should
> > work on the
> > parameters of non-templated functions as well as templated
> > ones, but it has
> > yet to be implemented that way. And there's some debate as to
> > what to do about
> > that.
>
> TDPL doesn't mention auto ref at all (not even as a function
> return type). The spec talks about auto ref as both function
> return type and parameter type for function templates.
Really? Are you sure? I was certain that it did. But it's been a while now
since I read it, so I'm not necessarily as clear on what's in it as I used to
be. I should probably reread it one of these days, but I don't really have
time right now.
> So, it
> seems auto ref as parameter for regular functions doesn't seem to
> documented anywhere (which is good if it's not ready yet).
I know that the original proposal for auto ref was not specifically for
templated functions but that Walter misunderstood what Andrei had meant and
just implemented them for templated functions (and the implementation used for
templated functions wouldn't work with non-templated ones). It would be
trivial to implement auto ref for non-templated functions, and I think that
there's a good chance that we will, but there's a some debate over that,
primarily because some people think that the term "auto ref" doesn't make
sense with what a non-templated function would have to do (which would be to
be ref underneath the hood and then assigne rvalues to lvalues on the stack so
that they could be passed to the function by ref).
- Jonathan M Davis
More information about the Digitalmars-d
mailing list