Rvalue references - The resolution
deadalnix
deadalnix at gmail.com
Sat May 4 15:50:32 PDT 2013
On Saturday, 4 May 2013 at 22:33:58 UTC, Walter Bright wrote:
> To put it another way, we wish to solve the problem without
> introducing more annotations. Rust's solution requires
> additional annotations, and so is not what we're looking for.
Require isn't the right word, or you hav to explain yourself much
more.
For instance, see :
http://smallcultfollowing.com/babysteps/blog/2012/07/19/yet-another-tutorial-on-borrowed-pointers/
"So far we have always used the notation &T for a borrowed
pointer. However, sometimes if a function takes many parameters,
it is useful to be able to group those parameters by lifetime."
In other terms, you need to have several parameters that passes
by ref + return by ref + you want a different lifetime for your
returned value than union of parameters's lifetime.
Which is a very specific case. That is far away from require.
That is most case don't require anything, while 1% require an
explicit lifetime. Unless you do some goofy stuff, you don't even
need to know about it. And if we decide that no explicit lifetime
== runtime check, it is never ever required. Just provided for
the dev that want to have the runtime check removed.
If we get more actual, return by ref in D are mostly usefull for
collections and ranges. None of theses would require explicit
lifetime ever.
More information about the Digitalmars-d
mailing list