On 19 October 2016 at 03:51, Jonathan M Davis via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:

> On Tuesday, October 18, 2016 13:36:42 Namespace via Digitalmars-d wrote:
> > On Tuesday, 18 October 2016 at 09:50:35 UTC, ketmar wrote:
> > > On Tuesday, 18 October 2016 at 06:30:15 UTC, Namespace wrote:
> > >> On Tuesday, 18 October 2016 at 02:54:08 UTC, Manu wrote:
> > >>> I just want to be able to pass an rvalue to a function that
> > >>> receives a
> > >>> const ref... that's why I came to this forum in the first
> > >>> place like,
> > >>> 7 years ago. 7 years later... still can't.
> > >>
> > >> I recently wrote a PR for p0nce D idioms, which shows how you
> > >> can do that
> > >> https://github.com/p0nce/d-idioms/pull/119
> > >
> > > there is a huge difference between "i can hack around it" and
> > > "i can do it".
> >
> > True. ;) It's like the static-array-without-length-and-gc hack.
> > You can do it with language constructs but it's inconvenient. So
> > it's up to Walter and Andrei to decide if this inconvenience is
> > bearable or not.
>
> Andrei decided ages ago that he didn't think that having const ref take
> rvalues was a good idea and that he doesn't think that it's a big deal. I
> don't recall whether Walter has said much on the issue, but AFAIK, he
> hasn't
> said anything to contradict that, and Andrei has been very vocal about how
> rvalue references were a horrible mistake in C++ and that he doesn't want
> to
> see anything of the sort in D.


Don't misunderstand, at no point I'm aware has anyone ever talked about
rval references.
This is all about passing rvalues as normal references.

People just want to be able to do this:

  void f(ref const(Vector) v);

  f(v1 + v2);

or:

  f(Vector(10,20,30));

That is all. The rval produces a temporary, and the temporary is passed to
the function.

Reply via email to