Properties no longer work?

Don Clugston dac at nospam.com.au
Thu Jul 27 07:48:19 PDT 2006


Jarrett Billingsley wrote:
> "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. 

Function types are just bizarre. I only recently discovered that C has 
them. Are you allowed to do anything with them, other than converting 
them to a function pointer by taking their address?



More information about the Digitalmars-d-learn mailing list