On Dec 22, 2011, at 3:06 PM, Stas Malyshev wrote:

> Hi!
> 
>> I'm going to have to disagree with you there.  Type hinting DOES save
>> me a LOT of effort in development.  I can stop worrying about checking
>> to make sure the parameter that I got is what I want it to be, and
>> just use it.  The runtime will check and enforce that for me.  When
> 
> I'm sorry but I don't see how what you describe is good. You stopped worrying 
> about checking inside the function, but unless you have started checking 
> outside the function you've just made your code less robust that it was 
> before. While in the case of strict class typing the case of mismatched 
> classes is so rare that occasional failure is easily identifiable, you didn't 
> really improve your code. I agree that it makes you type less - but the cost 
> of it is your application also does less - you don't have a capability of 
> gracefully handling a problem any longer. Again, with object strict typing, 
> this might be OK since failures are very rare and usually a result of obvious 
> mistakes caught early in testing - but if they are not, you didn't really 
> gain much.

I wouldn't be opposed to moving from raising an E_RECOVERABLE_ERROR to some 
type of exception.  In fact, I'd support it (in a discussion over that RFC).  
Your argument of not checkout outside the function is exactly why many are 
against type hinting scalars to begin with.  A generic "scalar" keyword being 
added would help some, but only protect against objects, resources and arrays.

> -- 
> 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
> 


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

Reply via email to