Re: RE: Optional scalar type hinting

From: Date: Thu, 03 Jan 2008 22:50:28 +0000
Subject: Re: RE: Optional scalar type hinting
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-34368@lists.php.net to get a copy of this message
type-hinting is asserting. checking of types is needed only on interface-border points (where
With strict checking, that means instead of calling: foo($bar); you'd have now to do: if(is_integer($bar)) { // stupid foo() call would blow up if passed not integer, so I have to manually handle it // oh wait, actually I don't have any way to handle it - I need foo() to be called to proceed // so let's just die("can't call foo() because \$bar is not integer"); } foo($bar); Now how it's easier or makes application more stable? What happens if foo() is changed and now accepts both integers and strings? What happens if someone forgets to write a wrapper? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#34368) next »