@property - take it behind the woodshed and shoot it?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jan 24 18:11:59 PST 2013
On Thursday, January 24, 2013 21:01:33 Andrei Alexandrescu wrote:
> On 1/24/13 7:41 PM, kenji hara wrote:
> > I think that the "optional parentheses" feature for normal functions
> > should always work in _shallowly_. Even if a function returns some
> > callable object, "optional parentheses" should not applied to the return
> > object recursively.
> >
> > That means:
> > void delegate() foo() { ... }
> > void main() {
> >
> > auto x = foo(); // typeof(x) == void delegate()
> > auto y = foo; // typeof(y) == void delegate()
> >
> > }
> >
> > Kenji Hara
>
> Interesting, so that would mean if anyone ever wants to get the delegate
> AND call it in one shot would need to write: foo()().
>
> I think this proposal has merit.
I believe that that's what we have now. The problem is when you want a
property which returns a delegate. And for that, we need @property. Getting
rid of @property makes it a problem, whereas with @property, it can work - as
can property functions which return delegates.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list