@property

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 10 04:07:12 PST 2015


On Tuesday, November 10, 2015 09:53:42 Gary Willoughby via Digitalmars-d-learn wrote:
> On Monday, 9 November 2015 at 22:42:16 UTC, Fyodor Ustinov wrote:
> > If this feature will be removed, it will be very lacking code,
> > like:
> >
> > writeln = "Hello, world!";
> >
> > :)
> > WBR,
> >     Fyodor.
>
> The feature is not being removed. Only the @property attribute
> and compiler check is being removed.

All that's being removed at this point is the -property switch which
enforced that non- at property functions be called with parens (since once UFCS
was introduced, everyone hated having to provide empty parens for function
calls that already had parens for template arguments). It's still up for
discussion what we're going to do in terms of enforcing that @property
functions get called without parens or whether we're going to require
@property for the setter syntax, though we almost have to make it so that if
an @property function returns a callable (e.g. delegate) that the parens
call that callable, otherwise you really can't have property functions that
return callables.

For now, @property is _mostly_ for documentation purposes (though it does
affect a few things like typeof). There are multiple DIPs on the topic
(e.g. http://wiki.dlang.org/DIP23 ), but until one is accepted, we don't
know for sure what's going to happen with @property.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list