On Monday, 28 January 2013 at 18:43:19 UTC, Andrei Alexandrescu
wrote:
On 1/28/13 1:04 PM, Dicebot wrote:
On Monday, 28 January 2013 at 17:52:45 UTC, TommiT wrote:
If you think my example of {start_time, end_time, duration}
represents
proper use of properties, then I don't see why you oppose
array.length. To me it seems like the same thing. Array has
some
length, and you can change it by changing its length
property. T
represents a certain time range, and you can change it by
changing any
of its three properties {start_time, end_time, duration} which
describe that time range.
T changes its inner encapsulated states. Period. It is no
different that
properties that calculate result on the fly, like range.empty
(which is
good property usage).
Array.length allocates. Takes from some global resources,
takes some
considerable time, calls some global allocating function.
For me it is a crucial difference that pushes symbol to the
world of
functions.
I guess you hate if people want their bigints to assign with a
= b.
Andrei
widget.height = 100 should be condemned, too - it changes the
state of the entire GUI system.
Let's face it: there are *no* objective criteria for determining
whether a mutator should be a function or property setter.