On 10 May 2013 06:07, Rob T <al...@ucora.com> wrote:

> On Thursday, 9 May 2013 at 19:43:25 UTC, Andrei Alexandrescu wrote:
>
>> On 5/9/13 3:39 PM, Rob T wrote:
>>
>>> So, if I understand correctly, auto ref for templates will end up doing
>>> exactly the same thing as auto ref for non-template functions? That
>>> would be perfect, otherwise it'll be terribly confusing.
>>>
>>
>> There would be clear restrictions on non-template functions, e.g. a
>> non-template cannot return auto ref.
>>
>> Andrei
>>
>
> OK I can understand that auto ref on return for a template function is
> something different, so disallowing auto ref on a regular function makes
> perfect sense to me.
>

It doesn't make sense though. You're creating an arbitrary restriction
because overloading an existing meaning doesn't apply (actually conflicts)
in this case.
auto is a template concept, it should not be applied here.

Refer to all the reasoning behind scope ref instead...

You can also create template functions with auto ref params that behave
> exactly like a non-template counter part by not specifying ref on the
> return, so it seems consistent and a sound solution from that perspective.
>

Umm, what if the non-template counterpart returns ref? Then it doesn't
behave the same.

D is a complex language, so stuff like this does take some getting used to,
> but it is very powerful and flexible, no two ways around it.
>

If this takes 'getting used to', you're basically admitting that it doesn't
make intuitive sense.

Reply via email to