Is DMD 0.166 RC 1.0?

Kristian kjkilpi at gmail.com
Tue Sep 5 04:52:32 PDT 2006


On Tue, 05 Sep 2006 02:16:46 +0300, Derek Parnell <derek at psyc.ward> wrote:

> On Mon, 04 Sep 2006 15:15:15 -0700, Walter Bright wrote:
>
>> 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.
>
> What 'odd case'?
>
> What 'programmer oversight'?
>
> The coder writes
>
>   a.prop++;
>
> because the 'prop' is a data item in the object that she wants to
> increment. It is irrelevant to the coder whether or not the class author
> decided to implement this data item as a property or data member. From  
> the
> perspective of the user of the class, 'prop' represents some data in the
> object. The implementation details are not a concern for the user of the
> class.
>

I agree fully. I thought that the whole point was to hide the  
implementation from the user.

I sent a message "Suggestion: properties should be treated as 'virtual  
members variables'" to digitalmars.D concerning this issue (I think it  
deserves its own thread).

(I know that I have sent these suggestions quite many, hopefully nobody  
thinks that I'm raving that these features must be in D or it'll suck, or  
something... ;) I hope that they will -- at least -- cause discussion that  
could lead to new ideas and improvements for this great language.)



More information about the Digitalmars-d-announce mailing list