@property - take it behind the woodshed and shoot it?
Jonathan M Davis
jmdavisProg at gmx.com
Fri Jan 25 00:29:52 PST 2013
On Friday, January 25, 2013 00:19:28 Walter Bright wrote:
> On 1/24/2013 5:15 PM, kenji hara wrote:
> > 1. Optional parentheses for normal functions should work shallowly IMO.
> > 2. Optional parentheses for property functions should not work. Applying
> > () for property function name always applied to its returned value.
> >
> > #1 is a ratification of current behavior. It allows the combination of
> > UFCS and removing redundant ()s.
> > #2 is a breaking change. If we need it, community consent is required.
>
> There is a way to do #2 without breaking existing code.
>
> Create a new property attribute, say, @prop. Imbue it with the new behavior.
> Leave the old @property as it is, and let it cycle through the usual
> warning, deprecation, removal process.
Considering that it's always been the plan that @property would be enforced
such that any use of it would be illegal with parens (it's explicitly among
the things tha TDPL says about @property), the expectation of pretty much
every D programmer is that that's how @property functions are to be used, and
it shouldn't come as any surprise when that's enforced. As such, I really
don't think that it's a big deal if we simply start enforcing that @property
functions be called without parens. And if you're really concerned about
breakage, then we could start with making it a warning rather than an error.
But I wager that in almost all cases, any such warning or error would be
triggered by a mistake rather than someone intentially using parens with an
@property function.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list