On Saturday, 10 November 2012 at 18:20:56 UTC, Manu wrote:
Hear hear!
I have dreams at night that look exactly like this proposal! :)
I think I had one just last night, and woke up with a big grin on my face...

I'm glad I'm not alone on this. :)

2) rvalues: prefer pass-by-value (moving: argument allocated
   directly on callee's stack (parameter) vs. pointer/reference
   indirection implied by pass-by-ref)

Is this actually possible?

It surely is and would only require the compiler to map the location of the parameter in the callee's future stack frame to the caller's stack frame. I think this is how DMD implements it.

Does the C/C++ ABI support such an action? GDC and LDC use the C ABI verbatim, so can this work, or will they have to, like usual, allocate on the caller's stack, and pass the ref through. I don't
really see a significant disadvantage to that regardless.

I'm not sure how C++ does it, I was wondering about that too actually after posting this. It quite possibly uses real references for '(const) T&&' (otherwise how would you be able to transform a passed lvalue reference to an rvalue reference via std::move() without copying it?), so my table may be incorrect for these 2 cells, although that wouldn't change anything really for the proposal, unless someone showed a use case for 'const T&&' where 'const T&' doesn't fit (I certainly can't think of any).

Reply via email to