On Monday, 28 January 2013 at 13:41:00 UTC, Dicebot wrote:
On Monday, 28 January 2013 at 13:37:36 UTC, Andrei Alexandrescu
wrote:
If we talk about _reasoning_, then properties have already
broken that because a.b may be a function invocation. Probably
it's about something weaker.
Andrei
No, it has been stated few times already (actually I have just
given answer to the same question to Adam) - properties should
be reasoned AS IF they are fields/variables, by design. They
are abstraction/encapsulation tools and their implementation
details should not matter to the reader. You see property - you
assume it is as field, because it looks like one.
That is why having .length of array as a property that
reallocates is so horrible.
I do agree, and want to push forward even more with an actual
example : TLS. TLS is implemented as a function call on some
systems. However, you manipulate TLS variable as variable in your
code.
This is the intended abstraction. The fact that a function is
called is an implementation detail. That is what a property is
about : providing data with an access pattern different than what
is wired in the compiler.