Newbie initial comments on D language - delegate

Janice Caron caron800 at googlemail.com
Tue Jan 29 23:53:10 PST 2008


On 1/30/08, Edward Diener <eddielee_no_spam_here at tropicsoft.com> wrote:
> You might need plain function pointers but you do not need 'function'. A
> 'delegate' which encompassed a 'function', with the object pointer part
> of the delegate being null in that particle case, should be implicitly
> convertible to a C function pointer.

In general, the compiler cannot tell at compile time whether or a not
a value is null at runtime (though in an expression like &f it
obviously can), so I don't think it can be quite that automatic.

Nonetheless, I'm inclined to agree that we probably don't need the
"function" keyword at all.

    delegate f;
    oldFashionedCFunction( f.funcptr );



More information about the Digitalmars-d mailing list