Properties

Nick Sabalausky a at a.a
Sun Jan 11 08:11:37 PST 2009


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:gkd53n$ikt$1 at digitalmars.com...
> Nick Sabalausky:
>> Even if it weren't for that, I would still consider this important enough 
>> to
>> be worth the hassle of changing it. It would be better than letting D
>> forever maintain the cruft of a particularly bad design decision (no
>> offense, Walter) in the same way that C++ would.
>
> But I am not sure that proposed idea is the best, because in Python (that 
> acts like that) you often enough write for mistake:
>
> x = foo
>
> Forgetting the (). In this case x gets a (kind of) reference to foo and 
> not to its result. You can do something similar in that D proposal:
>
> auto x = foo
>
> So I think &foo and foo() are more explicit and better (better == less 
> error-prone), to represent the pointer/delegate/closure, and to represent 
> the calling.
>

Yes, but 1. As you indicated, it could only happen in D when using an 
initializer on an "auto". And 2. I would imagine that would probably get 
caught as soon x was used.

But, if &foo is deemed to be better for referring to the function itself (ie 
without invoking), then using "foo" without "&" or "()" should be 
prohibited. (In fact, maybe that would be the ideal solution?) 





More information about the Digitalmars-d mailing list