Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32866 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28705 invoked by uid 1010); 18 Oct 2007 22:29:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28688 invoked from network); 18 Oct 2007 22:29:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2007 22:29:30 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 85.10.196.195 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 85.10.196.195 serveforce1.backendmedia.com Linux 2.6 Received: from [85.10.196.195] ([85.10.196.195:56828] helo=serveforce1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/CB-61918-84ED7174 for ; Thu, 18 Oct 2007 18:29:29 -0400 Received: from [192.168.0.163] (77-57-23-243.dclient.hispeed.ch [77.57.23.243]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by serveforce1.backendmedia.com (Postfix) with ESMTP id B1679122460E; Fri, 19 Oct 2007 00:29:53 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <1192703377.3026.18.camel@johannes.nop> References: <47170F2C.3070709@daylessday.org> <1192703377.3026.18.camel@johannes.nop> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-ID: <2D3110B2-1DD0-4E9F-A2D5-F9D118BAFE0A@pooteeweet.org> Content-Transfer-Encoding: quoted-printable Date: Fri, 19 Oct 2007 00:29:15 +0200 To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= , PHP Developers Mailing List X-Mailer: Apple Mail (2.752.3) X-backendmedia-com-MailScanner-Information: Please contact the ISP for more information X-backendmedia-com-MailScanner: Found to be clean X-backendmedia-com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.137, required 6, AWL 0.04, RDNS_DYNAMIC 0.10) X-backendmedia-com-MailScanner-From: mls@pooteeweet.org X-Spam-Status: No Subject: Re: [PHP-DEV] exception policy for core From: mls@pooteeweet.org (Lukas Kahwe Smith) On 18.10.2007, at 12:29, Johannes Schl=FCter wrote: > Hi, > > On Thu, 2007-10-18 at 11:45 +0400, Antony Dovgal wrote: >> On 17.10.2007 20:09, Lukas Kahwe Smith wrote: >>> Hi, >>> >>> I remember that we discussed the question of exception throwing from >>> core in the very early days of php 5, when the suggestion of turning >>> all errors into exceptions first came up. I remember that we decided >>> that exceptions should only be thrown from core on constructor =20 >>> errors >>> by default. Along the lines of PDO, extensions could allow users to >>> explicitly enable an exception mode. >> >> First of all, I have to say that I see nothing wrong in using =20 >> exceptions. >> Second, I see nothing wrong in using exceptions _in OO extensions_. >> And finally, I don't like the idea of having a special function in =20= >> each and every extension to control it's error level. >> PDO was built this way from the very beginning, but making this =20 >> some kind of standard would be a mistake IMO. >> >> You may not like exceptions, but that doesn't make them less useful. > > The possibility of changing the error mode at run-time makes it quite > hard to read code. Since you always have to check the error mode of =20= > the > object you're currently looking at. Therefore I think we should avoid > adding more of these switches in future - especially on an per-object > basis. Well I agree that this can be problematic. In the case of PDO one =20 might be passing a PDO instance to various libraries, which may rely =20 on exceptions being thrown or not. Personally I would not mind not =20 throwing exceptions for anything but constructor errors (actually I =20 think even those should be avoided), but that switch in PDO seemed =20 like an acceptable balance. regards, Lukas