Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67198 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29684 invoked from network); 29 Apr 2013 16:42:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2013 16:42:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=amaury.bouchard@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=amaury.bouchard@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.171 as permitted sender) X-PHP-List-Original-Sender: amaury.bouchard@gmail.com X-Host-Fingerprint: 209.85.216.171 mail-qc0-f171.google.com Received: from [209.85.216.171] ([209.85.216.171:63812] helo=mail-qc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/51-23191-903AE715 for ; Mon, 29 Apr 2013 12:42:49 -0400 Received: by mail-qc0-f171.google.com with SMTP id q2so3273423qch.30 for ; Mon, 29 Apr 2013 09:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=XNc/FVzWlK0VTp29XZTh4FV/DVMAGmvmwYnYNQ3q9Hw=; b=mNDR8pnfaeHvr4uL/mEntSLLgrE+tWIDEgGPreWcb7CDG8getEws5XNdM+m7rk+l6L wiH4Cdy6wZDnvT0zX8Z60sajSvXh63g5Qobj1W9Lsvo7Smgf8dgGYs15ZvGP2JPhyDXf t5k8OXBdOhY3a9DGxRnq1dutPyY7G2hLy9duucdVAt+KM1CdfG4Lf+YTQcDZI4uEhw1u Wo+KdElwMWnoS6VaUN2HM8GzvBchynL/D3kz/r7mVepURl+TWVY2YGJ+aasrk1xB30DF iJRNS2Jz2o1JdnMUEjtYby+XAVS42QNa7Gx2kwjGvMSgru8b9S/Enfn+ZaXtfEj97u8D qaYQ== X-Received: by 10.229.63.2 with SMTP id z2mr3727876qch.53.1367220380330; Mon, 29 Apr 2013 00:26:20 -0700 (PDT) MIME-Version: 1.0 Sender: amaury.bouchard@gmail.com Received: by 10.49.133.39 with HTTP; Mon, 29 Apr 2013 00:25:59 -0700 (PDT) In-Reply-To: <7D1B5825-255D-4DBE-85EB-FAED9A9CF0AB@gmail.com> References: <170891005.EmXIrsICLC@rofl> <7D1B5825-255D-4DBE-85EB-FAED9A9CF0AB@gmail.com> Date: Mon, 29 Apr 2013 09:25:59 +0200 X-Google-Sender-Auth: XTy7LcS28TggxikYtIgEcnqZuwM Message-ID: To: Camilo Sperberg Cc: Julien Pauli , Ferenc Kovacs , PHP Internals , Patrick Schaaf Content-Type: multipart/alternative; boundary=001a11c24ed419738204db7acd73 Subject: Re: [PHP-DEV] Continued try blocks From: amaury@amaury.net (Amaury Bouchard) --001a11c24ed419738204db7acd73 Content-Type: text/plain; charset=ISO-8859-1 Why not. But it will come in addition to "resume", not instead of it. Then: - "resume" => continue execution just after the point where the exception was raised. - "restart" => restart the whole try block. I don't understand the meaning of your "rollback". 2013/4/29 Camilo Sperberg > > On Apr 28, 2013, at 17:27, Julien Pauli wrote: > > > On Sat, Apr 27, 2013 at 3:56 PM, Amaury Bouchard > wrote: > > > >> 2013/4/27 Ferenc Kovacs > >> > >>> please don't reuse the continue keyword for it. > >>> > >>> There are a bunch of code out there where which uses exceptions in a > loop > >>> context. > >>> For example you have a retry counter decremented in a loop and you > catch > >>> the exceptions and retry until the retry limit is reached. > >>> > >> Fair enough. We can use "resume". > >> > > > > "continue" is just a keyword (syntactic sugar) we sure can change, I like > > "resume" yes :-) > > > > Julien.Pauli > > And how about a restart instead of resume? I have used try catch blocks as > a type of transactional block, so I think it would be nice if I could > restart the entire block instead of resuming from the last point where it > failed: > > $blue = 'blue'; > try { > $data = a($blue); > b($data); // This throws the dataIntegrityException > c(); > } catch (dataIntegrityException $e) { > $blue = 'is the new red'; > restart; // executes a(), b() and c() again > } catch (Exception $e) { > rollback(); > } > > Greetings. --001a11c24ed419738204db7acd73--