[Issue 8161] give an error for invalid property functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 18 18:13:37 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=8161

--- Comment #15 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Nick Treleaven from comment #14)
> This alone makes it an important feature.

Actually, I think that it's caused more bugs than anything - especially when
much is done with type introspection. Even though a property function tries to
act like a variable, it isn't one and only marginally acts like one. Being able
to call a function like a variable syntactically is useful, but semantically,
it really isn't one, and having the symbol effectively lie about what it is
makes writing good type introspection code harder (e.g. it made it harder to
figure out a way to determine whether a member was a static variable or not
when we originally tried to come up with how to implement hasStaticMember). As
a systems language, it really isn't possible for a function to act completely
like a variable, and having the function lie about it just because it's
intended to partially emulate a variable does more harm than good IMHO -
especially when it really has nothing to do with whether the function can be or
is used with property syntax.

> That would break much code significantly due to the above feature. AIUI
> there is no way the current language can simulate that feature.
> 
> I remind you again that this issue has nothing to do with optional
> parenthesis.

The point is that @property is considered a mistake by Walter and Andrei and is
very much in limbo. What we have is a half-baked feature that does almost
nothing and whose original design has clearly been abandoned. So, trying to
"fix" it without there actually being an official decision about what we're
going to do with it as a whole really doesn't make much sense - especially if
that involves adding any compiler warnings or errors with regards to its use.

--


More information about the Digitalmars-d-bugs mailing list