Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9068 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21845 invoked by uid 1010); 12 Apr 2004 15:43:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21772 invoked from network); 12 Apr 2004 15:42:59 -0000 Received: from unknown (HELO mail.mbobo.org) (213.133.123.182) by pb1.pair.com with SMTP; 12 Apr 2004 15:42:59 -0000 Received: from localhost (localhost [127.0.0.1]) by mail.mbobo.org (Postfix) with ESMTP id 5782C5772D1; Mon, 12 Apr 2004 17:42:59 +0200 (CEST) Received: from mail.mbobo.org ([127.0.0.1]) by localhost (debian [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06251-06; Mon, 12 Apr 2004 17:42:58 +0200 (CEST) Received: from [172.20.201.155] (h-67-102-19-107.snfccasy.covad.net [67.102.19.107]) by mail.mbobo.org (Postfix) with ESMTP id 1D857577146; Mon, 12 Apr 2004 17:42:57 +0200 (CEST) In-Reply-To: <5.1.0.14.2.20040412134325.039c7758@127.0.0.1> References: <1081740243.14476.11.camel@coogle.localdomain> <1081740243.14476.11.camel@coogle.localdomain> <5.1.0.14.2.20040412134325.039c7758@127.0.0.1> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-ID: <1101B839-8C98-11D8-BB64-000A95E073A0@php.net> Content-Transfer-Encoding: 7bit Cc: John Coggeshall , Derick Rethans , PHP Internals Date: Mon, 12 Apr 2004 08:42:55 -0700 To: Andi Gutmans X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at mbobo.org Subject: Re: [PHP-DEV] Exceptions and Errors From: sterling@php.net (Sterling Hughes) On Apr 12, 2004, at 3:45 AM, Andi Gutmans wrote: > At 12:41 PM 4/12/2004 +0200, Derick Rethans wrote: >> On Sun, 11 Apr 2004, John Coggeshall wrote: >> >> > As a matter of consistency, I would like to suggest that for those >> > extensions which have a OO/procedural syntax that the non-fatal >> errors >> > generated by those extensions be thrown as Exceptions when called >> from >> > an OO syntax. I have already committed such a change to Tidy, and I >> > can't see any serious reason why such a change can't be implemented >> for >> > internal classes. >> > >> > Feedback welcome. >> >> I think it's a stupid idea (actually OO is a stupid idea but that's >> something for another dicussion ;-): >> >> 1. In order to silently ignore failed queries you still have to put a >> stupid try..except block around it. >> >> 2. KISS: PHP is supposed to be SIMPLE; with all thos advanced OO stuff >> writing scripts for PHP starts becoming less and less easy. Sure, >> they are already using OO but that's just a notation. Some >> extensions >> are only OO, like DOM, but that doesn't mean that every Joe Average >> has any idea on what exceptions are. Please, kepe things simple. >> Don't force people. > > Derick, > > The fact that you have something personal against OOP doesn't mean > it's not good. > I think that functional context should continue to work as usual, but > there's a big advantage to be able to catch problems with try/catch > and not have to if() each internal function call separately (which you > probably don't do :) > I don't see a problem with OOP extensions throwing exceptions. > I like OO (*), and I think warnings (non-fatal errors) as exceptions are a stupid idea. Does that count? ;-) Exceptions in languages like Java are used explicitly to catch fatal errors, not to catch basic errors. Converting warnings to exceptions would change the meaning of a warning from something which is nice for development, or logging purposes, but handled by your control flow, into an unrecoverable error. Errors as exceptions are a different story. I don't think that's a bad idea at all. But leave good alone, warnings shouldn't be exceptions. -Sterling (*) Though my like is most definitely due to stockholm syndrome, and excessive brainrape. Nonetheless. :)