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

From: Date: Fri, 28 Mar 2003 02:08:02 +0000
Subject: Re: Re: [Zend Engine 2] Type hints revisited [IllegalArgumentException instead of E_ERROR]
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-404@lists.php.net to get a copy of this message
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

« previous php.internals (#404) next »