On 4/12/12 3:11 PM, Dmitry Olshansky wrote:
Interesting thing with non-escaping ref is that making truly unsealed
containers is hard while writing sealed ones made easier(and that's a
good thing btw).

There is a liability here however. Today, people who don't want to allow changes to their containers or ranges would routinely return rvalues from e.g. front().

If we allow function results to bind to ref parameters, people would think they modify stuff when in fact they don't do anything. Consider:

void swap(T)(ref T lhs, ref T rhs);
...
swap(r1.front, r2.front);

The user thinks the fronts of the ranges are swapped but nothing happens.

So we don't want to allow function results (including property results) to bind to ref parameters.


Andrei

_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to