Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80256 invoked by uid 1010); 3 Jan 2008 20:37:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 80238 invoked from network); 3 Jan 2008 20:37:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2008 20:37:32 -0000 Authentication-Results: pb1.pair.com header.from=jochem@iamjochem.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jochem@iamjochem.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: jochem@iamjochem.com X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 Received: from [194.109.193.121] ([194.109.193.121:50497] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/02-20810-8874D774 for ; Thu, 03 Jan 2008 15:37:31 -0500 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 4C791279BD2; Thu, 3 Jan 2008 21:37:25 +0100 (CET) X-Virus-Scanned: amavisd-new at moulin.nl Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (mx1.moulin.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8IdaqjW2AEsV; Thu, 3 Jan 2008 21:37:20 +0100 (CET) Received: from [10.0.13.105] (ip129-15-211-87.adsl2.versatel.nl [87.211.15.129]) by mx1.moulin.nl (Postfix) with ESMTP id DD22C278918; Thu, 3 Jan 2008 21:37:19 +0100 (CET) Message-ID: <477D477F.4010609@iamjochem.com> Date: Thu, 03 Jan 2008 21:37:19 +0100 User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Tomi Kaistila CC: internals@lists.php.net References: <200801031903.01980.tomi@cumulo.fi> <477D2CDB.3000005@zend.com> <200801032201.24355.tomi@cumulo.fi> In-Reply-To: <200801032201.24355.tomi@cumulo.fi> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: jochem@iamjochem.com (Jochem Maas) Tomi Kaistila schreef: >> Broken record perhaps? I am getting a bit tired of this "just use Java >> argument", it's perhaps even a bit arrogant. From what I read there is >> plenty of people that want type hints for static types - there's a few >> patches out there, it doesn't slow down the general case. So why should >> we *not* add it? (And yes, I changed my mind) > Same here. I am getting generally tired of the attitude some > politically-correct people seem to have about writing "javaish" code. What > the heck is "javaish" code anyway? Most features that exist in both PHP and > Java can also be found in myriad of other languages and it has so far not > stopped the development team from adding a feature when it is clearly useful > and (most importantly) desired an uncounted number of people. > > In fact those who oppose the feature seem only capable of doing so with > hair-splitting rhetorics. > >> am I the only one to consider E_FATAL (as generated for class typehints) >> makes type hinting useless - given that there is no compile stage at which >> to catch typehint related mistakes > In principle you are correct. But E_FATAL errors should not happen in a > program that is in production use. If they do, it seems someone was not doing > their job properly. you are right, they shouldn't - but who can say that every execution permutation has been tested and hammered shut in their code (let alone someone else 3rd party lib or extension)? in practice mistakes do occur - and saying someone has not been doing their job properly is little consilation to the end user, client or manager (who gets a white screen of death) ... there is no reason not to let the application try to gracefully handle a mistake like this ... besides I was under the impression that E_FATAL meant the engine was in an unstable state and was unable to continue execution - I don't see why a typehint failure would cause an unstable engine state (rather the engine is presuming that the code is *going* to create an unstable state if it were to continue ... which is not very helpful in my book). > > I am not convinced throwing an exception is the best course of action. If it > was, you might make the argument that all errors should be exceptions, while > traditionally it is the other way around and changing that is beyond the > scope of this thread. I actually like the current "division of labor" when it > comes to error handling. > > When PHP detects an error, it should actually be an error. Exceptions are > convenient for the code that you as a PHP developer can throw. They are > especially a blessing when writing library code. That way exceptions work for > the error management, instead of competing with it. > > I say use E_WARNING at this stage. If there is some large redecorating with > PHP's error handling in the future, it can be changed then. that is a very sane arguement. I'll have to concede :-) > > Tomi Kaistila > PHP Developer >