DIP 36: Rvalue References
kenji hara
k.hara.pg at gmail.com
Tue Apr 9 17:41:38 PDT 2013
2013/4/10 Namespace <rswhite4 at googlemail.com>
> http://wiki.dlang.org/DIP36
>
Typo:
> Similar to "auto ref" but no extra template instantations.
Similar to "auto ref" but no extra template instantiations
One question:
void test1(scope ref A a) {}
test1(A(42)); // @safe, this temporary value is valid for mutation and
"scope" ensures it does not leak scope
A a = A(23); // no difference
test1(a);
void test32(T)(scope ref T id) {}
test32(1337); // Prohibited, no address for "1337"
test32(a.id); // fine and @safe
Why test32 does not accept rvalue like test1? I think that "scope ref"
should always behave same for rvalue argument - create temporary and take
its address to "scope ref" parameter. Consistent behavior with any types is
important for the generic programming.
Other than comment, looks good. Good work, Randy and Михаил!
Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130410/a0dabe66/attachment-0001.html>
More information about the Digitalmars-d
mailing list