Pure functions in D

bearophile bearophileHUGS at lycos.com
Mon Sep 29 16:15:26 PDT 2008


BCS:
> To forbid such a cast, you would need to forbid pointers to pure functions. 
> You can subvert the type system with unions if nothing else and for something 
> like pure, there is no point in limiting casts if there are ways around it.

If it turns out that casting impure => pure is very dangerous (and I don't know yet how much dangerous it can be), then it may be useful anyway to forbid the simple impure => pure cast, forcing the programmers to perform that cast with a union. So it becomes a way to tell the programmer that operation is very discouraged :-)

Bye,
bearophile



More information about the Digitalmars-d mailing list