But if you want to be more strict and limit the coder to use your
functions only with a specific parameter signature (and thats the

The purpose of signature overloading in most languages isn't input type control, it's different functionality on different types. However, unlike many other languages, PHP does not have static typing, and that would not allow to know which function is called immediately, only at runtime. This has both performance impact and code transparency impact - you wouldn't know which function will be called until runtime. I am not convinced this added complexity serves any real need - though you are welcome to prove otherwise, i.e. present some use case when one can't do without signature overloading.

only reason to use type hints - to ensure the method is used
correctly and build more robust applications), it is better to tell

BTW, I'm not sure how exactly it makes the code more robust - if you call it with wrong type and it's not checked, the app would probably die on fatal error. If you call it with wrong type and it is checked, the app would die on fatal error couple of lines above. Unless you use some kind of static analysis tool to verify your app prior to deployment (if you know such tools please tell me!) I don't see much difference here, mostly syntax sugar and enforcing right style (which is not bad - just it's not that big a deal).

lost in this move (boo!). No longer can you override a method &
provide an incompatible signature. This mixture of strict OO + PHP's
traditional loose typing is really shooting PHP in the foot.

If you don't want strict signatures - why you are using them? Nobody forces you to type your arguments. And inheritance is certainly not for overriding objects with incompatible signatures, if you try to do it you are misusing it.

I think, that this ist the reason why nearly nobody uses this great
new feature (to ensure that the passed parameters are correct),

The above statement is not true. This feature is used by many developers. Please stop using "unless you do it my way, nobody will use PHP" argument - it doesn't work.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to