DIP23 draft: Fixing properties redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 3 09:47:00 PST 2013


On 2/3/13 10:48 AM, Johannes Pfau wrote:
> Am Sun, 03 Feb 2013 04:40:44 -0800
> schrieb Jonathan M Davis<jmdavisProg at gmx.com>:
>
>> On Sunday, February 03, 2013 13:34:14 Jacob Carlborg wrote:
>>> On 2013-02-03 09:16, Andrei Alexandrescu wrote:
>>>> Walter and I have had a discussion on how to finalize properties.
>>>>
>>>> http://wiki.dlang.org/DIP23
>>>
>>> What about:
>>>
>>> writeln = "asd";
>>>
>>> Allowed or not?
>>
>> I take it that you didn't read the DIP. At the very beginning of its
>> section on "Write properties:"
>>
>> -----------
>> In order to use the assignment operator "=" property-style, the
>> @property annotation MUST be used.
>> -----------
>
> There's a example on the page though which contradicts this:
>
> static int x;
> ref int fun1() { return x; }
> fun1 = 42;

This introduces no contradiction. It's simple assignment to the result 
of fun1.

Andrei



More information about the Digitalmars-d mailing list