My thoughts & tries with rvalue references

kenji hara k.hara.pg at gmail.com
Fri Apr 5 02:52:15 PDT 2013


I also think that we should not change current `in` meaning.
It is already used as the shorthand of `const` widely, and it has value
semantics (make a copy of given argument). That's the major motivation to
add new syntax "scope ref" and "in ref".

Kenji Hara


2013/4/5 Namespace <rswhite4 at googlemail.com>

> I am surprised to hear that redundant storage classes are considered an
>> error by dmd :) Makes no sense for me, typical "generic code gen" use case
>> story.
>>
> http://dpaste.1azy.net/**3ef7a084 <http://dpaste.1azy.net/3ef7a084>
>
>
>  Sorry then, I have misunderstood you then. I do want both "scope ref" and
>> "const scope ref" too, but I was thinking that simple easy-to-use shortcut
>> (in) should match most idiomatic and safe use case, and that should be
>> "scope const ref". With an additional benefit of being able to replace
>> values with refs transparently due to storage class/qualifier restrictions.
>>
>> I don't have strong opinion here, it is just an idea that came to my mind
>> today and felt tempting ;)
>>
>
> I like it also but was afraid that it could break user code. 'in ref' is
> allowed since 2.060 and many users use 'in' because it is shorter than
> 'const' and feels like the opposite of 'out'. :/
> Otherwise that would be a good idea. Let's hear what Kenji says.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130405/b03c7170/attachment.html>


More information about the Digitalmars-d mailing list