Make dur a property?
Johannes Pfau
nospam at example.com
Wed Jan 23 10:18:45 PST 2013
Am Wed, 23 Jan 2013 09:45:49 -0800
schrieb "H. S. Teoh" <hsteoh at quickfur.ath.cx>:
> On Wed, Jan 23, 2013 at 06:26:51PM +0100, Adam D. Ruppe wrote:
> > On Wednesday, 23 January 2013 at 17:13:05 UTC, Timon Gehr wrote:
> > >That is completely nonsensical behaviour. Just ignore -property.
> >
> >
> > Amen! -property MUST die. @property should fix the real problems
> > with properties, not leave that broken while adding new problems.
>
> I'm starting to think that perhaps @property should be disposed of
> completely.
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. Need a real-world example?
http://www.digitalmars.com/d/archives/digitalmars/D/ModuleInfo.unitTest_cannot_be_called_twice_183357.html
(with proper @property the first example should work as expected).
So if most people really think @property is such a problem we can
probably remove it, but we have to make sure examples like this one are
not ambiguous.
More information about the Digitalmars-d
mailing list