Properties no longer work?

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Jul 25 20:04:50 PDT 2006


"Hasan Aljudy" <hasan.aljudy at gmail.com> wrote in message 
news:ea6fsm$2lb6$1 at digitaldaemon.com...
> Did properties stop working?
>
> assuming object abc has a method foo:
> # auto x = abc.foo;
> gives a compiler error: x cannot be a function (or something like that)

Stop using type inference.  ;)

int x = abc.foo;

When you write "abc.foo" as the initializer for a type-inferenced 
declaration, it tries to deduce the type of the declaration before 
converting the property access to a function call.  Thus, it thinks you're 
trying to create a variable x with the same type as abc.foo; i.e. a function 
type (not a function pointer, just a function), which is illegal.  This 
might be a bug, but it's been around for a while, and not just since 0.163. 





More information about the Digitalmars-d-learn mailing list