Amen to that.  Type checking at compile time and run time are _very_
different things.

Just to voice my opinion on this type hint thingie: IMHO it's useless to
have a type hinting feature that has no way of catching the wrong type
passed.  If it may be caught, great let's do that, if not let's nuke
type hints.  Then we move on :-)

 - Stig

On Fri, 2003-03-28 at 14:42, Sterling Hughes wrote:
> 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
> 

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

Reply via email to