UFCS syntax I never saw before.
aliak
something at something.com
Thu May 24 22:03:38 UTC 2018
On Tuesday, 22 May 2018 at 13:59:16 UTC, Steven Schveighoffer
wrote:
> The derailed plan was to leave alone the ability to call no-arg
> functions without parentheses, but to REQUIRE @property to call
> an argument-taking function with the assignment style.
>
> See the DIP here: https://wiki.dlang.org/DIP23
>
> Written by Walter and Andrei. I can't remember why it didn't
> happen.
>
> -Steve
Aha. Thanks for the link!
It feels like the only difference between a no-arg function that
is @property and one that is not is that the former could be
invoked with optional parentheses and the latter should be
illegal with parentheses.
Whereas an argument taking function marked as @property should
probably allow read or write operations depending on whether or
not it's invoked with an implicit first argument or not:
@property int f(int) { ... }
1.f; // read op
f = 1; // write op
And to make parentheses illegal as well of course.
More information about the Digitalmars-d-learn
mailing list