Is the -property compiler flag broken/bad idea?
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Jun 5 17:12:38 PDT 2013
On Wed, Jun 05, 2013 at 08:08:16PM -0400, Jonathan M Davis wrote:
> On Thursday, June 06, 2013 01:00:12 Adam D. Ruppe wrote:
> > On Wednesday, 5 June 2013 at 22:31:15 UTC, Namespace wrote:
> > > Sorry I don't get it. Are you for or against optional
> > > parenthesis for function which are not marked with @property?
> >
> > I'm for optional parens, but I'm also for @property, because the
> > problems @property ought to be fixing are semantic, not syntax,
> > and have no impact at all on non- at property functions.
> >
> > The questions of @property and optional parens actually have
> > nothing to do with each other, besides the unfortunate fact that
> > they come up together in these threads and -property confuses the
> > two. Optional parens is a feature of function call syntax.
> > @property is about making a function look like a variable to the
> > outside world, which means that function call syntax shouldn't
> > apply to it anymore either way.
>
> Which is essentially the position of weak property enforcement.
> Property functions must be used as properties, but non-property
> functions are free to be called without parens.
[...]
IMO, this is needless conflation of the need for properties (function(s)
that behave as though they were class/struct variables) and calling
functions without parens. I'm a bit disappointed that the big long
discussion on @property in the main D forum turned out to be 50%
confusion over these two distinct issues, and 50% in-fighting that left
no real conclusion as to how to implement @property correctly.
I was hoping for a clean way for functions to imitate class/struct
variables via @property, independently of whether or not non- at property
functions are allowed to be called without parens. But alas, it was not
to be. :-/
T
--
May you live all the days of your life. -- Jonathan Swift
More information about the Digitalmars-d-learn
mailing list