Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61743 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66828 invoked from network); 25 Jul 2012 07:26:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2012 07:26:00 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:34643] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/CC-27263-88F9F005 for ; Wed, 25 Jul 2012 03:26:00 -0400 Received: by vbbfs19 with SMTP id fs19so352431vbb.29 for ; Wed, 25 Jul 2012 00:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=xqaT6HSJamoRFoiwEjbYjPqlWyCeaJKnlY6xaTjgyrQ=; b=Vo62MlOPqNivrAI4/kPvv49qJoBzeIAAZta6E1+7Vbzr44OlJ5BChAsby25GIEWfZy /qzVd6Nh2ZAW9JC4WL2rcsiop0kQrvoUNK0Z9fNmcLGiXZGiApEIVrUwnadEPXE+xr0f SR4yG6kDDtWO7fJ2zSgWfifBbtagI++ZcqK6025RGPNmrNRkbVk5Vi0hYPkhR8+KxHDQ kSVoxYaRUQ97OjAxN+KssQXHyf07zBuzGi3WyqxWImXm0+NNVdomtYHxnb6cgs7H0g5a xd8ZBsFZhWMlNRdoRSydWiaSpdKWDJfDng/oA110+upMfl+opOULkhu3LOU0ptDSQ/CP 0VVw== Received: by 10.220.148.196 with SMTP id q4mr17478257vcv.36.1343201157757; Wed, 25 Jul 2012 00:25:57 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.195.3 with HTTP; Wed, 25 Jul 2012 00:25:37 -0700 (PDT) In-Reply-To: <500EA69F.2040908@ajf.me> References: <500EA69F.2040908@ajf.me> Date: Wed, 25 Jul 2012 15:25:37 +0800 X-Google-Sender-Auth: 8msJ0DDlQVF3szrj3Ynxej5wBCk Message-ID: To: Andrew Faulds Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions From: laruence@php.net (Laruence) On Tue, Jul 24, 2012 at 9:43 PM, Andrew Faulds wrote: > On 24/07/12 14:40, Levi Morrison wrote: >> >> On Tue, Jul 24, 2012 at 7:35 AM, Nikita Popov >> wrote: >>> >>> On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: >>>> >>>> Hi: >>>> As the previous threads disscussed, I make a implemention. >>>> >>>> here is the RFC: https://wiki.php.net/rfc/finally >>>> >>>> any suggestions? >>> >>> The finally clause comes with a very strong promise that the code in >>> the clause will run in absolutely any case (short of sigkill, maybe). >>> 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. >>> >>> 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. >>> >>> I obviously think that PHP should adopt this model too (as it gives >>> the programmer more control), but until all fatal actions are turned >>> into exceptions, I'm strongly against introducing "finally". The main >>> point of the clause is to have a guarantee, and that is simply >>> currently not present. You actually get a better guarantee if you just >>> use destructors. >>> >>> Nikita >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> I definitely agree with Mr. Nikita Popov. Unless we have a >> guarantee of `finally` running for PHP fatal errors, then this is not >> particularly useful. >> > I also agree with Mr. Popov here. PHP's fatal errors are, well, fatal, > meaning we can do absolutely nothing about them. I guess that's something to > change for PHP6: making them into serious exceptions, but ones that can be > caught (maybe a different class, like Java's RuntimeErrors and Exceptions, > IIRC). Obviously things like running out of memory can't be dealt with, > though. Hi: FATAL ERRORS in PHP is kind of static errors, which means it can be avoided by well programing. however as Rasmus said, it's not we can't guarantee that(zend_try), it's just not necessary for the 'finally' keyword, *finally for exceptions* thanks > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Laruence Xinchen Hui http://www.laruence.com/