Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1218 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23559 invoked from network); 4 May 2003 17:21:51 -0000 Received: from unknown (HELO mailout06.sul.t-online.com) (194.25.134.19) by pb1.pair.com with SMTP; 4 May 2003 17:21:51 -0000 Received: from fwd05.sul.t-online.de by mailout06.sul.t-online.com with smtp id 19CNBF-0005Aa-03; Sun, 04 May 2003 19:21:41 +0200 Received: from baumbart.post.rwth-aachen.de (520072483730-0001@[80.142.181.159]) by fwd05.sul.t-online.com with esmtp id 19CNBB-1zZphoC; Sun, 4 May 2003 19:21:37 +0200 Reply-to:marcus.boerger@post.rwth-aachen.de Message-ID: <5.1.0.14.2.20030504190606.09482ed0@pop.t-online.de> X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Sun, 04 May 2003 19:21:35 +0200 To: Andi Gutmans Cc: internals@lists.php.net In-Reply-To: <5.1.0.14.2.20030503220627.036a9888@127.0.0.1> References: <5.1.0.14.2.20030504021938.09452980@mailbox.rwth-aachen.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-Sender: 520072483730-0001@t-dialin.net Subject: Re: [PHP-DEV] exceptions instead of errors From: marcus.boerger@t-online.de ((Marcus =?iso-8859-1?Q?B=F6rger?=)) At 04:32 04.05.2003, Andi Gutmans wrote: >At 02:53 AM 5/4/2003 +0200, Marcus B=F6rger wrote: >>Some help of the engine would be good: >>- automatically set EH_THROW mode at "try" >>- automatically set EH_NORMAL mode at "catch" (first outmost catch) > >Huh? I think it's definitely not obvious that I'd want these to happen=20 >automatically. Actually I personally wouldn't, because I'd prefer PHP to=20 >continue the way it works and only use exceptions in user-land. > >>If noone objects i will commit this on monday evening. > >Please don't before this is discussed. We have discussed this kind of=20 >thing quite a few times and our opinion was that error handling in PHP=20 >shouldn't be changed. We wouldn't want some configuration switch to change= =20 >how the scripts work nor is it a good idea if the same script behaves=20 >differently according to one switch. There will surely no switch, that would be the stuiest thing we cold do. >Anyway, we can discuss this again but definitely I don't think we should=20 >jump the gun with commits in this area until people really think of the=20 >whole picture. We have a large user base out there and we still want all=20 >of the user-base to "talk" in the same language. Large user base? Who the hell uses ze2 or php5 widely out there? The patch is intended for the new php5/ze2 oo features and will not change= =20 any php4 features or its behavior. It simply makes it possible to throw exceptions in ctors (and for that=20 there is now other solution). Everything else the patch offers can surely be discussed: automation with=20 try/catch and so on. What i like would be: 1) procedural (aka php4) no change (aka simply errors as of now) 2) oo (aka new php5/ze2 features) always throw exceptions instead of errors. for example: let's assume we have an extension "example" consisting of a function=20 "example_test", a namespace "example" containing a function "factory" and a class "whatever" with a "whatelse": example_test(); //-> normal operation or error mechanism $obj =3D example::factory(); // -> object creation or exception $obj =3D new example::whatever(); // -> object creation or exception $obj->whatelse(); // -> normal operation or exception WHY: becasue this only changes new things we don't have yet and it is easy= =20 to learn and deal with: "procedural =3D errors, oo =3D exceptions". >I won't really be around for the next two weeks so maybe it's best to wait= =20 >or in the least make sure Zeev takes part in this discussion. Then i hope you can answer now :-) >Thanks, >Andi > >P.S. -BTW, what does SQLite do? Just as Wez said. And you may take a look at my patches and tests for it on= =20 the url i gave. Because this extension lets you test exceptions with ctors and the factory() function. regards marcus