Mafi: > If you want a NullPointerException as part of your program flow, you can > use enforce() (in std.contracts I think). I don't think catching a > NullPointerException in a big code block where you don't know which > dereferencing should fail is good style.
enforce() is not a panacea (panchrest); as far as I know DMD doesn't inline any function that contains enforce(). So sometimes an assert() is better, especially if it's inside a contract (precondition, etc). DesignByConstrac-style programming is not something that just happens, you have to train yourself for some time for it. Bye, bearophile
