Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61704 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56627 invoked from network); 24 Jul 2012 17:34:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 17:34:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 64.22.89.134 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 64.22.89.134 oxmail.registrar-servers.com Linux 2.6 Received: from [64.22.89.134] ([64.22.89.134:53924] helo=oxmail.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/F2-42538-C9CDE005 for ; Tue, 24 Jul 2012 13:34:20 -0400 Received: from [192.168.0.200] (5ad32874.bb.sky.com [90.211.40.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 30B093E8047; Tue, 24 Jul 2012 13:34:15 -0400 (EDT) Message-ID: <500EDC82.1050309@ajf.me> Date: Tue, 24 Jul 2012 18:33:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Stas Malyshev CC: Nikita Popov , Laruence , PHP Internals References: <500EDBF5.1030805@sugarcrm.com> In-Reply-To: <500EDBF5.1030805@sugarcrm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions From: ajf@ajf.me (Andrew Faulds) On 24/07/12 18:31, Stas Malyshev wrote: > Hi! > >> In particular this means that... >> ... if a die() is execute somewhere in the try clause (or a called >> function) the finally clause must still be run. >> ... if a parse error or other fatal error occurs in the try clause (or >> called function) the finally clause must still be run. >> ... if the user interrupts the process the finally clause must still be run. > No I don't think so. finally clause is used to clean up resources > allocated/initialized by the code inside try clause. All the above > functions will terminate the script and thus all the resources that were > allocated will be freed. If you so something more persistent, then a) > use shutdown functions b) know that the script can be killed at any > moment anyway, so PHP can not guarantee you anything. I don't see how > finally ever implied it would be called on die(). > >> Basically this requires that all of the actions that are currently >> fatal need to be converted to exceptions. E.g. Python has special >> SystemExit and KeyboardInterrupt exceptions, as well as SyntaxError >> and so on. > So basically this requires that PHP will be converted to Python. ;) I'd > almost write an RFC but then I remembered somebody already wrote Python! :) > > PHP risks losing some of its uniqueness to fixing things, unfortunately. But losing bad features and moving forward is good, right? -- Andrew Faulds http://ajf.me/