auto ref - again

deadalnix deadalnix at gmail.com
Sat Jan 26 22:28:24 PST 2013


On Sunday, 27 January 2013 at 06:13:25 UTC, Era Scarecrow wrote:
> On Sunday, 27 January 2013 at 04:38:44 UTC, deadalnix wrote:
>> On Sunday, 27 January 2013 at 02:28:26 UTC, Era Scarecrow 
>> wrote:
>>> Having ref accept rValues seems like a bad idea. If the 
>>> source is const/immutable then it might be allowed, but more 
>>> likely temporaries will be made for convertion from rValues 
>>> to lValues, then passing off the temporaries. The temporaries 
>>> to work right likely need to be at the top-most scope of 
>>> whatever function you happen to be in; Beyond that I'm not 
>>> sure how else the auto ref could be implemented safely.
>>
>> I have yet to see an instance of such problem in real life, 
>> but quite frankly, I tired to argue.
>
>  I would have thought it was obvious. I have done before where 
> all my work was done from a ref. Now being that i wouldn't want 
> to duplicate my code twice, the non-ref simply forwards to the 
> ref. auto ref may automate removing the need to explicitly 
> forward temporaries or make them yourself; Kinda like how scope 
> makes things easier.

You completely fail to address the point raised.

Back on the point, quoting « Having ref accept rValues seems like 
a bad idea. ». D accepted it for ages, some language accept it by 
design (java for instance).

Now can someone show me the code ?


More information about the Digitalmars-d mailing list