Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61680 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92034 invoked from network); 24 Jul 2012 13:40:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 13:40:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:50805] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/45-17533-BC5AE005 for ; Tue, 24 Jul 2012 09:40:28 -0400 Received: by lago2 with SMTP id o2so986728lag.29 for ; Tue, 24 Jul 2012 06:40:24 -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=gFU8wsTWerxDXAqOQrN1hKe1j7iHhgv2DIt6bhfIOc0=; b=egoiG/e3GNBjDQKz2vW7o7zBAxvugREAusN1aeiK5WX6HuasCzxFPoEXB6ugOoBCKT Ypm8pUa5hP1LYScQEhK+hW6qLanocmiZuYuMNib1OlhVo8RkzU8CS00h0ZzZuzjyHmzP Y/wZvFXnMXUqXa5Vg09saghvfO/8FNSwaZR0bVx8wnLbwj9kh5wu2jHnmkpviB5kggQA RshMkkIzF86AzJXnlxZCL+F8pTuZVR9CNbZK26RDqvDAKlt7vJm0LZp9NN77L6+T5UIN hyvN2ztnayDAy5UCy5TaJJVXnyW3w/5C6N9nsvp2ZCY0B2T0D6CozTJF2+bap1dd7ff2 vknA== MIME-Version: 1.0 Received: by 10.152.103.109 with SMTP id fv13mr21612843lab.33.1343137223879; Tue, 24 Jul 2012 06:40:23 -0700 (PDT) Received: by 10.112.1.199 with HTTP; Tue, 24 Jul 2012 06:40:23 -0700 (PDT) In-Reply-To: References: Date: Tue, 24 Jul 2012 07:40:23 -0600 Message-ID: To: Nikita Popov Cc: Laruence , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions From: morrison.levi@gmail.com (Levi Morrison) 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.