Denis Koroskin wrote: > What's a rationale behind an issue described bug 2621? > http://d.puremagic.com/issues/show_bug.cgi?id=2621 > > Why isn't it allowed anymore? > > It broke quite a lot of my code. And while it is fixable by doing > > auto tmp = someFunctionThatRetunsStruct(); > someMethodThatAcceptsStructByReference(tmp); > > it looks ugly and unnecessary.
To resolve this, let's consider two suspicions I have: 1) People use 'ref' for speed. Fairly obvious. I do it too. :) 2) People don't use 'out' for speed. This seems obvious, since 'out' does _more_ work than 'ref'. 2a) 'out' has stronger semantic meaning than 'ref'. Because of this, I recommend allowing temporaries to be passed to 'ref' parameters, but not 'out' parameters. That way, you can still use 'out' to implement extraneous return values.