Is DMD 0.166 RC 1.0?
Walter Bright
newshound at digitalmars.com
Mon Sep 4 15:15:15 PDT 2006
Derek Parnell wrote:
>> It's an error in C++ for the same reason (can't initialize a reference
>> with a non-const).
>
> You are right Walter. However, a[5] looks looks like an lvalue doesn't it?
> In fact, it could have been one until the class author changed it to a
> property. I feel that Properties need to behave as if they were data
> members rather than methods when used as such. Thus ...
>
> f(a.prop);
> and
> f(a.prop());
>
> would look *and* behave differently but without surprising the coder.
>
> And this also means that
>
> a.prop++
>
> needs to work too. It is a great surprise to new comers that obvious things
> like this are not working as expected.
Whether it's consistent or not depends on how you think about it - what
your mental model is of it. I'd rather have the odd cases produce error
messages rather than have the compiler paper over what is likely a
programmer oversight.
More information about the Digitalmars-d-announce
mailing list