Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12523 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26809 invoked by uid 1010); 1 Sep 2004 13:01:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21417 invoked from network); 1 Sep 2004 13:00:06 -0000 Received: from unknown (HELO newweb.akbkhome.com) (202.81.246.113) by pb1.pair.com with SMTP; 1 Sep 2004 13:00:06 -0000 Received: from develop ([192.168.0.40] ident=alan) by newweb.akbkhome.com with esmtp (Exim 4.33) id 1C2Uor-0000zH-Hy for internals@lists.php.net; Wed, 01 Sep 2004 21:06:48 +0800 Message-ID: <4135C8C3.5000705@akbkhome.com> Date: Wed, 01 Sep 2004 21:04:03 +0800 User-Agent: Mozilla Thunderbird 0.7.3 (X11/20040805) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: parse errors when testing for undefined exceptions From: alan@akbkhome.com (Alan Knowles) This is a simple example of why making a parse error out of undefined Exception types is going to be very problematic. function test($a) { if (!extension_exists('sqlite')) { return; } try { SQLite::query($a); // parse error!!! - if we dont have sqlite, we dont have SQLite exception! } catch(SQLite_Exception $e) { echo "problem with query"; return; } } This has a big knock on effect that we can not lazy load Exception definitions, even if they are only used in Exceptional situations. (its pretty much the same issue as instanceof - forcing the loading of code, that may never be used, except to test it's non-existance.) Regards Alan