Properties: a.b.c = 3

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jul 29 11:19:37 PDT 2009


Ary Borenszweig wrote:
> Andrei Alexandrescu wrote:
>> Ary Borenszweig wrote:
>>> Andrei Alexandrescu wrote:
>>>> Bill Baxter wrote:
>>>>> Yeh, I don't understand how any of this has anything to do with
>>>>> properties.  It's the same question if you ask what should
>>>>>
>>>>>  a.b().c = 5
>>>>>
>>>>>  do.  It's the same issue whether you have properties or not, and
>>>>> needs a solution whether you have properties or not.
>>>>
>>>> Well the problem is that a.b().c = 5 makes it clear that there's a 
>>>> function call in the mix, so the field-like behavior is not 
>>>> necessarily to be expected.
>>>
>>> No. Whenever you do
>>>
>>> Expression1 . Expression2 . Expression3 = Expression4.
>>>
>>> and Expression 2 is a struct type, and Expression 3 is not a static 
>>> field of the struct, that should be an error.
>>
>> I don't think D allows expressions to the right of ".".
> 
> Ok, then change the rule to
> 
> a . b . c  = d;
> 
> where b is an identifier or a function call, c is an identifier.

How about this fella then.

a.b[5].c = d;

Should work or not?


Andrei



More information about the Digitalmars-d mailing list