Pure functions in D

bearophile bearophileHUGS at lycos.com
Mon Sep 29 15:33:14 PDT 2008


Sean Kelly:
> Otherwise, something like this should work:
> void debugln_(...) { /* forward to writefln */ }
> alias pure void function(...) SomeFn;
> SomeFn debugln = cast(pure SomeFn) &debugln_;

I think you have written a static cast from the function pointer of an impure function to a function pointer of a pure function. I kind of hope the compiler will forbid a cast like that, I think it may give troubles :-)

This topic makes me more and more amused as time passes :-)

Bye,
bearophile



More information about the Digitalmars-d mailing list