@property - take it behind the woodshed and shoot it?
JS
js.mdnq at gmail.com
Sat Aug 10 05:27:16 PDT 2013
On Thursday, 24 January 2013 at 08:35:01 UTC, Walter Bright wrote:
> This has turned into a monster. We've taken 2 or 3 wrong turns
> somewhere.
>
> Perhaps we should revert to a simple set of rules.
>
Here is my mindless proposal after reading some of the posts.
1. Properties are data. Cannot be called with parenthesis, unless
it returns a delegate, in which case the delegate is called. The
address of a property is invalid(possibly gotten through a trait).
2. Properties cannot be used in UFCS calls, unless they return a
delegate. Only UFCS chaining allows for parenthesis-less calls.
e.g., (). -> .
Properties are great, C# doesn't have any issues with them... so
why should D? From the little reading, the best I can tell is
that the issue comes directly from UFCS and trying to avoid using
parenthesis.
Conflating the issue between properties and UFCS isn't an issue
with properties or UFCS but with distinguishing between them.
UFCS wants property like behavior but then that causes problems
with properties themselves. Properties want function call
behavior but then that makes them look like functions, yet this
defeats the purpose of a property.
Alternative, use a different syntax for chaining UFCS's. Instead
of using ()., use something like func1:func2:func3:func4; where :
seems to be a somewhat unused symbol... ~, >, >>, or others could
potentially be used. Such a symbol AUTOMATICALLY is replaced with
`().` since everything is a function call. (no properties can
exist in the chain unless they return delegates, in which case
the delegate is uses)
More information about the Digitalmars-d
mailing list