Make dur a property?

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Wed Jan 23 14:32:51 PST 2013


On Wed, 23 Jan 2013 15:11:35 -0500
Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:

> On 1/23/13 1:18 PM, Johannes Pfau wrote:
> > Please do not forget the main reason for @property: Returning a
> > delegate from a function can become ambiguous without it:
> >
> > int a(){return 42;}
> > void b() {return&a;}
> >
> > auto var = b; //OK
> > auto var2 = b(); //is var2 == b or == 42?
> >
> > It might be an extreme corner case, but it's inconsistent behavior
> > and confusing.
> 
> Agreed. I think we should require @property only for those cases, and 
> not any others.
> 
> Andrei

I'd rather not see more "Sometimes the language lets me skip XXXX, and
sometimes it complains" get introduced into the language. That
complicates the language and makes the language harder to understand.

There are cases where that strategy has certainly made sense, but at
this point I think you're just grasping for ways to justify leaving in
the non-beneficial "Use either 'foo' or 'foo()', whichever you want,
anytime you want" sloppiness. And making sure that non-feature can
remain by introducing more special-cases into the language to patch
over the problems with the non-feature.



More information about the Digitalmars-d mailing list