On Thu, Apr 17, 2008 at 10:59 AM, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> Hi! > > Seeing how you work for zend I thought maybe you have used the zend > > framework = ) Sorry in my example I used "int" instead of "numeric", but my > > point is the same, grep in zend framework for is_bool. > > > > It might come as a surprise to you, but I did not write whole Zend > Framework personally :) Moreover, as even more surprise I did not even > inspect personally each line of code. As a final shock, I am not convinced > functions in PHP should throw exceptions when parameters don't match - and > even if they do, first they should attempt to make sense of parameters > (which makes string hints like "integer" and "string" make no sense - you > can convert a lot of things to int or string). Even if they can't, it's much > better to be handled on user code level with error message that makes sense > and way that makes sense for application - but I could kind of live with the > scenario where these hints would work as internal function types work now. > However, that's not what is proposed - what is proposed is that if you've > got int typehint, '1' would be rejected. Having such restriction makes no > sense and goes contrary to what PHP and dynamic languages in general are. That first part made me laugh, hehe. I wanted to just point out that your company was a good example of how code could be minimized using type checks. I understand your philosophy with dynamic types in php, but there are times that these dynamic types have really shot people in the foot and added exploits and bad coding practices, which is why high-quality frameworks push users to use correct types, zf is just one of many examples my friend. I get your point of 12 and '12', which is why I proposed earlier numeric hinting would be very appropriate. -Chris