auto ref is on the docket

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 23 12:13:28 PDT 2015


On Tue, 23 Jun 2015 14:33:49 -0400, kinke <noone at nowhere.com> wrote:

> On Tuesday, 23 June 2015 at 18:11:21 UTC, bitwise wrote:
>> On Mon, 22 Jun 2015 19:09:45 -0400, Timon Gehr <timon.gehr at gmx.ch>  
>> wrote:
>>
>>> There is no reason to prevent templates from using the mechanism that  
>>> generates only one copy. The two mechanisms shouldn't share the same  
>>> syntax, because then there is no way to tell them apart for template  
>>> functions.
>>
>> You would be losing the optimization of passing primitive types by  
>> value, wouldn't you?
>
> Not if you keep the current `auto ref` template syntax AND introduce  
> another syntax `scope ref` for non-escapable references also accepting  
> rvalues.

I don't think 'scope ref' is on the table at this point(although I do  
believe it should be).

And I still think Timon's statement is untrue. There is a reason, which is  
that the new auto ref syntax forces reference parameters for all  
types(even primitives), where the old template approach does not.

   Bit


More information about the Digitalmars-d mailing list