Properties no longer work?
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Thu Jul 27 10:41:12 PDT 2006
Don Clugston wrote:
> 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?
C has them? Where did you see that, I was under the impression that C
only had function pointers, and they were all the same, such that the
value a function was the same as the value of taking the address of the
function:
(func) == (&func)
Similarly to what happens to arrays.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d-learn
mailing list