@property - take it behind the woodshed and shoot it?

kenji hara k.hara.pg at gmail.com
Thu Jan 24 16:41:56 PST 2013


2013/1/25 Jonathan M Davis <jmdavisProg at gmx.com>

> On Thursday, January 24, 2013 22:24:58 Adam D. Ruppe wrote:
> > On Thursday, 24 January 2013 at 21:09:39 UTC, Adam Wilson wrote:
> > > The problem with @property isn't @property, it's D's
> > > insistence on optional parens.
> >
> > No, this isn't a problem; function call syntax has nothing
> > whatsoever to do with @property because a property is NOT
> > logically a function!
>
> D's insistance on optional parens _does_ cause problems with functions that
> return delegates, but @property itself isn't really affected by optional
> parens save for the visual ambiguity caused by optional parens.


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130125/56ee9593/attachment.html>


More information about the Digitalmars-d mailing list