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

eles eles at eles.com
Mon Jan 28 23:52:57 PST 2013


On Monday, 28 January 2013 at 21:43:25 UTC, Andrei Alexandrescu 
wrote:
> On 1/28/13 4:32 PM, Dicebot wrote:
>> On Monday, 28 January 2013 at 18:43:19 UTC, Andrei 
>> Alexandrescu wrote:
>> Arrays, however, will
>> not suffer at all from switching to array.resize(42) syntax 
>> from
>> array.length = 42 syntax.
>
> Well I think this is a given now. So again - time to adjust 
> preferences :o).

My feeling is that the array.length getter/setter problem is 
affected by the perceived assymetry between the getter and the 
setter operation.

Even more, that feeling is exacerbated by the involvment of a 
canonical type. People expect some expensive background 
operations for user-defined, complicated types, but not for 
canonical types. Properties too, are plagued by this, but at 
least there the choice is explicitly marked and assumed.

As for the a=b bigInts vs the array.length=5 problem: the former 
operation affects the content of a and b. The latter not only 
affects the content of array.length, but also the very content of 
array itself. I know the border is thin, however, it exists at 
the psychological level, since many will gladly accept 
reallocation in a=b, but not in array.length=5.

Maybe is just the power of habit. Maybe not.


More information about the Digitalmars-d mailing list