@property - take it behind the woodshed and shoot it?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jan 24 23:13:17 PST 2013
On Friday, January 25, 2013 07:47:27 eles wrote:
> On Friday, 25 January 2013 at 04:21:07 UTC, Jonathan M Davis
>
> wrote:
> > On Thursday, January 24, 2013 22:52:36 Andrei Alexandrescu
> > wrote:
> > I hate optional parentheses with a passion, but I think that
> > it's quite clear
> > that too many people want them (including many who want
> > @property) and that
>
> I hate the optional parentheses (I really see no point for this
> except in to!"conversions" but that's templates), I want
> @property to function just like its C# equivalent and I really do
> not understand why those two issues are so difficult to accept
> and implement.
The issue is that lots of people like optional parentheses. I expect that even
if there were no support for properties in the language whatsoever, the folks
who like to be able to elide parens would still like that and want it.
However, even if we're stuck with parenless function calls being legal, we can
still have @property function like it does in C# and require that it be used
without parens. It's just that many function calls would be able to look like
they were getter properties if they're called without parens.
But because of the tons of arguments over @property (many of them really being
over parenless function calls rather than @property itself) and the fact that
Andrei has never liked the idea of @property in the first place, Walter and
Andrei seem to be trying to get rid of it and simplify the language - hence
this thread. So, we're forced to argue in favor of @property.
At this point, I think that the best that we can hope for is
1. Parenless function calls will continue to function essentially as they have
been.
2. It will be illegal to use a non- at property function as a setter.
3. @property will be kept, and @property functions must be called without
parens.
If we go that route, we may also be able to make some improvements to property
functions to make them closer to how variables are (e.g. make a.prop += 1
valid), and property functions will be able to be essentially as they are in
C# as far as functionality goes, but we'll be stuck with parenless function
calls.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list