DIP23 draft: Fixing properties redux

Johannes Pfau nospam at example.com
Sun Feb 3 08:23:13 PST 2013


Am Sun, 03 Feb 2013 17:01:59 +0100
schrieb "TommiT" <tommitissari at hotmail.com>:

> On Sunday, 3 February 2013 at 15:48:00 UTC, Johannes Pfau wrote:
> >> -----------
> >> 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;
> 
> That example has nothing to do with properties. It's just:
> 
> static int x;
> ref int fun1() { return x; }
> fun1() = 42;
> 
> ...except that the empty parens were omitted (which is allowed 
> there).

OK, but then 'In order to use the assignment operator "="
property-style, the @property annotation MUST be used.' is wrong or a
least misleading. IMHO "fun1 = 42;" is using "=" 'property style'. But
if you think of it as a parentheses-less call that indeed makes sense.


More information about the Digitalmars-d mailing list