Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61679 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90639 invoked from network); 24 Jul 2012 13:35:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 13:35:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:58872] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/E4-17533-794AE005 for ; Tue, 24 Jul 2012 09:35:20 -0400 Received: by lbgc1 with SMTP id c1so10079428lbg.29 for ; Tue, 24 Jul 2012 06:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9XS7mam34Y/ogQQRgjKSesOkLyUuAkhWevpRCAdTrCg=; b=btn/cZMsx/Fig/CXfjrQKp7jj+LGz9T8KN0Dr2y0vPe013yGbPmwGFoI0sbqp1RWlS FMmE+fZn2DZH6ul3unENllBRzELMx/RlSCkxUqOcGX66C0fRK7O827FbSJqLeO9bHndd tQvK3Y1pya5lz1JRNSbiCOOpc5ZlIfM+AfjDVRWIy4xpGu6FQUW+MYGxB6h+ULfYgdeu aJi95AskAaKIqQBzEd/fcahjgVOWmLfCFRprFFCH1YZHQyG1znAk8YiXl2iRAK4lOwdz 2BHb4IyOAlK6jdK3zCc6G7Tp+VoZ2umVdCcU41PcbXRxQI09Q3X1c29Y3h1eJrF5sw+G 7rBQ== MIME-Version: 1.0 Received: by 10.112.17.200 with SMTP id q8mr9618385lbd.11.1343136915380; Tue, 24 Jul 2012 06:35:15 -0700 (PDT) Received: by 10.152.114.70 with HTTP; Tue, 24 Jul 2012 06:35:15 -0700 (PDT) In-Reply-To: References: Date: Tue, 24 Jul 2012 15:35:15 +0200 Message-ID: To: Laruence Cc: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions From: nikita.ppv@gmail.com (Nikita Popov) 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