The liabilities of binding rvalues to ref

Manu turkeyman at gmail.com
Thu May 9 16:51:47 PDT 2013


On 10 May 2013 08:50, Timon Gehr <timon.gehr at gmx.ch> wrote:

> On 05/09/2013 11:35 PM, Manu wrote:
>
>> ...
>>
>>
>> I don't think this is entirely true, auto ref is a template concept,
>>
>
> In the current implementation, but not necessarily.


It should stay that way. It's reasonable what it does in it's current
implementation.

 that is, "automatic ref-ness", it selects the ref-ness of the argument
>> automatically, at compile time, just like auto applied everywhere else
>> (selects a type for instance, at compile time).
>>
>
> auto was carried over from C and originally stands for local lifetime. It
> does _not_ mean "apply type deduction here".


Eh? 'local lifetime' doesn't sound like it has anything to do with 'apply
type deduction here' to me; which is what D does.

 This concept doesn't
>> make any sense applied to a non-template. It *IS* a ref as specified by
>> the programmer, there's nothing 'automatic' about it.
>>
>>
> Most keywords are poorly chosen.
>

Is this an argument to continue that trend?
That said, I don't find this to be particularly true. Most things make
reasonable sense.

 So to say it will do 'exactly the same thing' is a misunderstanding. I
>> argue that 'auto ref' as applied to non-templates will only create
>> confusion, it effectively re-enforces the type of confusion that you
>> have just shown.
>>
>> This is the reasoning for the argument behind scope ref, which to my
>> mind actually makes good sound sense, and should lead people to a proper
>> understanding of what you are actually doing.
>> Considering the key argument against 'scope ref' is that people don't
>> want to require more attributes to make use of it,
>>
>
> This is inaccurate.


It's the most consistent argument against scope-ref.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130510/64f16cf6/attachment.html>


More information about the Digitalmars-d mailing list