On 6/20/07, Jim Wilson wilson.jim.r@gmail.com wrote:
Since not returning anything in PHP is equivalent (more or less) to returning null, is there any concern that the extension writer's intent was to do so? Or is this simply a massive case of forgotten "return true" statements?
I believe it's "simply a massive case of forgotten 'return true' statements."
I totally agree that the the forgetting of return true is a big problem -
I've done it myself. I'm just not fully convinced that throwing a full stop is the best answer. (I'd like to hear what others think on the matter).
Personally, I find this to be a good solution. I've lately become quite used to fail-fast languages such as java, and I've found that such eager exception throwing *really* helps you to not make such simple mistakes that result in hours of debugging. It's much better to have something explode on you than have programs that pretend to work, but with subtle and hard-to-find bugs.
I frankly can't think of a situation where someone would *need* to return null--at least, I've not seen a case of it yet; I'm sure in cases where you want to return null, you can get by fine with returning true. Could you perchance think of an example where this would be necessary?