DIP23 draft: Fixing properties redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 3 11:53:25 PST 2013


On 2/3/13 11:28 AM, kenji hara wrote:
> 2013/2/4 Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org
> <mailto:SeeWebsiteForEmail at erdani.org>>
>
>     We need to add this to the proposal. There are two schools of
>     thought here:
>
>     1. Make properties emulate regular variables as much as possible. In
>     that case &a.p is the same as &(a.p), i.e. it applies to the
>     returned value. (One counter-argument here is that properties should
>     seldom return a reference because that breaks encapsulation.)
>
>     2. Allow people to do whatever they need to do without much
>     aggravation. In that case &a.p obeys the normal rules of taking a
>     method's address, and &(a.p) applies to the returned value.
>
>     I favor (2) and put it in http://wiki.dlang.org/DIP23. Will talk to
>     Walter.
>
>
> I have thought about the problem, and filed an enhancement.
> http://d.puremagic.com/issues/show_bug.cgi?id=9062
>
> But, Walter disagreed against it.
> http://d.puremagic.com/issues/show_bug.cgi?id=9062#c13
>
>   Kenji Hara

Now that an overhaul is on the table, that warrants a second look.


Andrei


More information about the Digitalmars-d mailing list