Properties: a.b.c = 3

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jul 29 07:38:08 PDT 2009


Michel Fortin wrote:
> On 2009-07-28 22:33:53 -0400, Walter Bright <newshound1 at digitalmars.com> 
> said:
> 
>> The issue is what if b is a property, returns a temporary object, and 
>> that temp's .c field is uselessly set to 3?
>>
>> It's a classic problem with properties that are implemented as functions.
> 
> With the local namespace approach I propsed a little while ago, you 
> could allow "subproperties":
> 
>     namespace a {
>         namespace b {
>             namespace c {
>                 int opGet() {...}
>                 void opAssign(int) {...}
>             }
>         }
>     }

We're looking for a modular solution - one that allows one person to 
define the type of b and another person to define the type of a, which 
has a member b.


Andrei



More information about the Digitalmars-d mailing list