Hi!

That said, PHP is not Java, and type hinting in PHP is very
different.  It is, in fact, type *hinting*.  This is a runtime
feature.  Only interface validation is verified at compile time, so
we have to consider performance vs. feature in these cases.

Naming it "hinting" was probably the worst mistake in PHP
documentation since "safe mode". The word hinting implies it's just something non-mandatory, that can be used if needed, but ignored if not. While using typing is indeed not mandatory, once used, it *is* mandatory check that can not be ignored and produces fatal error in case of mismatch. The only difference is that in Java this error is detected in compile time, while in PHP it is a runtime failure, usually taking down the application in the middle of processing, without possibility of proper recovery. I'm not sure we're having the better deal here. Performance is irrelevant here, more or less, since typing checks won't take much time unless you have insanely deep class hierarchies (you have to compare object's class and probably his parents' to the prescribed type). Stability and maintainability of such code is an issue.

--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to