On Sunday, 27 January 2013 at 14:09:17 UTC, Andrei Alexandrescu
wrote:
On 1/27/13 8:05 AM, deadalnix wrote:
It seems here that captures provide you a new copy every time.
why not
after all ? What is the problem here ?
The property, which is intended to behave as a field as much as
possible, in this case continues to look like a field but
doesn't act like one. That means that switching transparently
between a field and a property (the holy grail of good
properties) will silently break code.
OK, I understand. Do you suggest that calling function on rvalue
should be prevented ?
BTW, unless you create a temporary storage, you can't call any
method on
a struct. This is why in the first place struct literal MUST
have a
storage (so it make sense to bind them to ref).
I don't have your definition of "storage".
Some piece of memory to store the struct in. Depending on the ABI
that is not guaranteed that an rvalue has a storage.