Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7815 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77029 invoked by uid 1010); 13 Feb 2004 17:57:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76905 invoked from network); 13 Feb 2004 17:57:25 -0000 Received: from unknown (HELO edwardbear.org) (216.179.74.133) by pb1.pair.com with SMTP; 13 Feb 2004 17:57:25 -0000 Received: by edwardbear.org (Postfix, from userid 1000) id E10C94EC2E; Fri, 13 Feb 2004 18:54:29 +0100 (CET) Date: Fri, 13 Feb 2004 12:54:29 -0500 To: Andi Gutmans Cc: internals@lists.php.net Message-ID: <20040213175429.GC702@bumblebury.com> References: <5.1.0.14.2.20040213194729.02b6f718@127.0.0.1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.1.0.14.2.20040213194729.02b6f718@127.0.0.1> User-Agent: Mutt/1.5.5.1+cvs20040105i Subject: Re: [PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_default_classes.c zend_default_classes.h zend_execute.h zend_execute_API.c From: sterling@php.net (Sterling Hughes) > > The reasoning is that it allows users to do a catch-all (which otherwise > we'd add to the language syntax). It also adds cleanliness to the Exception > hierarchy and allows PHP code to interact with PHP code which isn't written > by the developer knowing that there's a common interface (such as > getMessage()) which the exception always adheres to. That improves the > ability of exception handling especially debugging and logging > significantly. > That second part is a Throwable interface, not a base class (and Exception isn't even an ABC.) > i.e. > > try { > ...// Main code which calls PEAR, SOAP, Smart, external stuff and > so on.... > } catch (Exception $e) { > print "Damn something is really wrong here\n"; > print $e->getMessage(); > } > I get the concept, that's the reason Exception was added. But its meant to be a voluntary thing (I believe this has been discussed before btw), a standard class that gives users something to build upon, should they want to. I think an all-your-base-is-belonging-to-Exception is the wrong way to go. If you really want a catch-all or some type of consistency the way to go is either a Throwable interface (which makes it more of a pain to write exceptions) or the generic: catch ($e) { } syntax. _Sterling -- "Reductionists like to take things apart. The rest of us are just trying to get it together." - Larry Wall, Programming Perl, 3rd Edition