Calling delegate properties without parens
Piotr Szturmaj
bncrbme at jadamspam.pl
Sat Apr 14 18:01:09 PDT 2012
Artur Skawina wrote:
> @property is for functions masquerading as data, i'm not sure extending it
> to pointers and delegates would be a good idea. What you are asking for is
> basically syntax sugar for:
>
> struct CommonInputRange(E)
> {
> bool delegate() _empty;
> @property auto empty() { return _empty(); };
> @property auto empty(typeof(_empty) dg) { _empty = dg; };
> E delegate() _front;
> @property auto front() { return _front(); };
> @property auto front(typeof(_front) dg) { _front = dg; };
> void delegate() popFront;
> }
>
Yes, I was thinking about this, but it adds unnecessary overhead. I want
to call delegates directly.
I think the whole idea is harmless because semantically, from the user
perspective, delegates and function pointers works just like normal
functions. So, why not?
More information about the Digitalmars-d-learn
mailing list