Am 19.01.2012, 19:19 Uhr, schrieb Jonathan M Davis <[email protected]>:
On Thursday, January 19, 2012 11:33:24 Andrei Alexandrescu wrote:
On 1/19/12 11:29 AM, torhu wrote:
> The reason would be that if it looks like field access, it should
behave
> like that.
The difficulty is in knowing where to stop. The only things that behaves
exactly like a field access is a field access. This is a known issue in
C++, e.g. smart pointers "are smart but aren't pointers".
Yeah. It's generally expected that properties may return stuff which is
generated on each call. They're _simulating_ a member variable rather
than
being one. I don't think that the fact that a new value is returned each
time
is particularly relevant, especially since as long as the AA hasn't been
altered, the returned values are equivalent.
- Jonathan M Davis
I just came across some C++ code and came to the conclusion, that
properties and indexed access should not modify the structure. In other
words all my @property and opIndex will probably also by const. An
exception to that being caching and access counting.