Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17607 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13972 invoked by uid 1010); 8 Aug 2005 13:57:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13957 invoked from network); 8 Aug 2005 13:57:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2005 13:57:02 -0000 X-Host-Fingerprint: 194.109.193.120 unknown Linux 2.4/2.6 Received: from ([194.109.193.120:33757] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 54/1D-04646-DA467F24 for ; Mon, 08 Aug 2005 09:57:01 -0400 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 1B24E8E923 for ; Mon, 8 Aug 2005 15:57:03 +0200 (CEST) Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22923-04 for ; Mon, 8 Aug 2005 15:57:00 +0200 (CEST) Received: from [192.168.1.16] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id 306088A0BB for ; Mon, 8 Aug 2005 15:57:00 +0200 (CEST) Message-ID: <42F764A7.30705@iamjochem.com> Date: Mon, 08 Aug 2005 15:56:55 +0200 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: php internals References: <42F7587B.6050901@schlitt.info> <200508081450.46458.johannes@php.net> <42F75FA0.6090404@schlitt.info> In-Reply-To: <42F75FA0.6090404@schlitt.info> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at moulin.nl Subject: Re: [PHP-DEV] type hinting throwing a fatal error From: jochem@iamjochem.com (Jochem Maas) Tobias Schlitt wrote: > Hi Johannes Schlueter! > On 08/08/05 14:50 you wrote: > > >>>>The throw an Exception when SPL disabled and an InvalidArgumentException >>>>when it is enabled. > > >>>That's senseless when writing applications that shall be version >>>independant. Just sticking to Exception should be fine. > > >>No it is not, in your application you can still simply catch Exception to be >>independent of SPL since the InvalidArgumentException class extends the >>Exception class. But by using nested Exceptions you can catch them >>independently. Else you would have to catch every Exception, parse the error >>message or trace to see wether it was a problem while calling the >>function/method or some code inside the function/method went wrong. > > > The point is, that it's senseless to have it throw any exception that > can be disabled, when you want to write portable applications. In that > case you still have to stick to catch Exception and have no benefit of > it throwing anything else, when SPL is enabled. > > I would pretty much appreciate it having thrown an > InvalidArgumentException, but then this should work everywhere. I guess creating a new special exception (e.g. TypeHintException) that extends Exception as part of the php core (as opposed to living in SPL) is a stupid idea? IMHO btw, semantically, calling it S(tandard)PL and then making it so that it's not standard (i.e. it's an extension) seems odd. > > Regards,