How to assert a function signature in D2.008?

Steven Schveighoffer schveiguy at yahoo.com
Wed Dec 5 11:40:35 PST 2007


"Sean Kelly" wrote
> Steven Schveighoffer wrote:
>> "Craig Black" wrote
>>> "Sean Kelly" wrote in message
>>>> I guess the reason that this matches "void function" rather than "void 
>>>> delegate" is to avoid the need for handling each separately?
>>>>
>>>>
>>>> Sean
>>> To me this is confusing because you are taking the address of an 
>>> instance function without specifying the context pointer.  It doesn't 
>>> result in a delegate but it shouldn't result in a function either. 
>>> Maybe there should be another type for "delegate without context 
>>> pointer".
>>
>> It is consistent with other uses of typeof.  typeof is a special compiler 
>> directive that says "give me the type of what this instruction would be". 
>> It doesn't actually execute the instruction.
>
> So because &f doesn't involve an instance, the compiler just makes it a 
> function pointer rather than a delegate, regardless of whether the 
> function is static?  I suppose that makes sense.

I was responding to Craig's confusion as to using typeof with an invalid 
instance :)  I, like you, think it should be delegate instead...

-Steve 





More information about the Digitalmars-d mailing list