Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Type hints revisited [IllegalArgumentException instead of E_ERROR]

From: Date: Fri, 28 Mar 2003 13:42:06 +0000
Subject: Re: [Zend Engine 2] Re: [PHP-DEV] Re: [Zend Engine 2] Type hints revisited [IllegalArgumentException instead of E_ERROR]
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-419@lists.php.net to get a copy of this message
This again gets to my nit regarding runtime features in a dynamically typed language. One of the reasons type checking in C, C++, Java is a good thing is its done at compile time, not runtime. Type mistakes, especially in large libraries can be pesky things, often hard to check for (and often harmless). A PHP script should not automagically bail out on a type mismatch. I think that if this called in a try {} loop an exception should be thrown (will this be achieved by George's patch?) -Sterling On Thu, 2003-03-27 at 21:08, Andi Gutmans wrote: > At 09:49 PM 3/27/2003 +0000, Wez Furlong wrote: > >Please lets have exceptions here, otherwise you will render type-hints > >useless (they are intended primarily for OO programmers anyway). > > I wouldn't call them useless. It's the same as a script compiler where you > would error out if you don't use the same type except that in our case it'd > be at run-time. > > > >I'm somewhat concerned that we are implementing a lot of the new OO > >features in a half-hearted fashion; I understand that there is a balance > >to maintain between easy-accessibility and "enterprise" features. > > Yes, it is very important to keep the balance. I wouldn't call throwing an > exception if the wrong type is passed as enterprise. We are talking about a > situation which is an error condition in any case. Don't make more of a > deal out of it then what it really is. I don't think we should force people > who are using OOP in a subtle way to have to start handling exceptions > especially as we're keeping all of the rest as E_ERRORS. > > > >I've mentioned several times now that unhandled exceptions look just > >like E_ERRORS to procedural/non-OO programmers; please can we have the > >new OO-related features throw exceptions rather than trigger E_ERRORS as > >it allows "real" programmers to write more robust code. > > Again I disagree. What is a "real" programmer? You have decided that in > real programming wrong types in parameters throw exceptions. This is a very > shallow way of looking at it. I don't think "real" programmer == Java with > all due respect. > > Andi -- "First they ignore you, then they laugh at you, then they fight you, then you win." - Gandhi

« previous php.internals (#419) next »