Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17615 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57906 invoked by uid 1010); 8 Aug 2005 17:58:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57890 invoked from network); 8 Aug 2005 17:58:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2005 17:58:45 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:41766] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 11/8C-04646-45D97F24 for ; Mon, 08 Aug 2005 13:58:44 -0400 Received: from [192.168.1.3] (dsl-082-083-243-003.arcor-ip.net [82.83.243.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 1C0EA35C379; Mon, 8 Aug 2005 20:17:40 +0200 (CEST) Date: Mon, 8 Aug 2005 19:58:43 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1214163086.20050808195843@marcus-boerger.de> To: Tobias Schlitt Cc: Johannes Schlueter , internals@lists.php.net, Sebastian Bergmann In-Reply-To: <42F75FA0.6090404@schlitt.info> References: <42F7587B.6050901@schlitt.info> <200508081450.46458.johannes@php.net> <42F75FA0.6090404@schlitt.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] type hinting throwing a fatal error From: helly@php.net (Marcus Boerger) Hello Tobias, Monday, August 8, 2005, 3:35:28 PM, you 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. If you plan to support PHP builds without SPL then that most likley means that you have dropped other built-in default extensions too. Probably because of their memory space to reduce loading time. In that case you are not up for portability or have made a major mistake already in the beginning. Anyway there is no argument here. If you go for portable apps in the sense that any extension can be diabled then catching plain Exceptions should be more than good enough. You cannot expect to have full blown oo support when you disable the one oo extension. As a side note we could probably also move all exception declarations from SPL to the engine but then we'd loose the possibility to support builds without SPL. At the end of the day i'd even like to drop reflection support from the engine and move it to a specialized extensions - again - for speed/memory reasons. best regards marcus