@property needed or not needed?

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 20 11:19:54 PST 2012


On Tuesday, November 20, 2012 20:12:56 Adam D. Ruppe wrote:
> On Tuesday, 20 November 2012 at 19:06:22 UTC, Jonathan M Davis
> 
> wrote:
> > Given the fact that this subject is extremely devisive, I
> > suspect that the
> > best that we can hope for at this point is for lax property
> > enforcement
> 
> @property shouldn't be about enforcement. This is the fundamental
> flaw in the -property switch. While I think you and I are talking
> about the same goal, this is an important distinction to make:
> the fix isn't syntax. It is a semantic rewrite.
> 
> After referencing a property is rewritten to be a call, the
> syntax will just work:
> 
> @property int foo() {}
> 
> int a = foo(); // the error here is NOT "you must not use () on
> properties". It is "type int is not callable"
> 
> This is something that's bothered me about the @property debate
> since day one: we spend all this time talking about syntax....
> but that's a side effect, not the core question.

It's the same result. @property means that the function is treated as a 
variable, so it doesn't make sense that parens be used. If the error treats it 
like a variable to the point that it complains about trying to use parens on 
the variable rather than the fact that you tried to use parens on an @property 
function, all the better.

- Jonathan M Davis


More information about the Digitalmars-d mailing list