@property - take it behind the woodshed and shoot it?

Dicebot m.strashun at gmail.com
Mon Jan 28 10:04:21 PST 2013


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.


More information about the Digitalmars-d mailing list