Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96698 invoked from network); 28 Feb 2012 22:57:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2012 22:57:37 -0000 Authentication-Results: pb1.pair.com header.from=ww.galen@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ww.galen@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: ww.galen@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:47817] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/FC-36673-0EB5D4F4 for ; Tue, 28 Feb 2012 17:57:36 -0500 Received: by iaeh11 with SMTP id h11so3529254iae.29 for ; Tue, 28 Feb 2012 14:57:34 -0800 (PST) Received-SPF: pass (google.com: domain of ww.galen@gmail.com designates 10.50.197.135 as permitted sender) client-ip=10.50.197.135; Authentication-Results: mr.google.com; spf=pass (google.com: domain of ww.galen@gmail.com designates 10.50.197.135 as permitted sender) smtp.mail=ww.galen@gmail.com; dkim=pass header.i=ww.galen@gmail.com Received: from mr.google.com ([10.50.197.135]) by 10.50.197.135 with SMTP id iu7mr4749174igc.50.1330469854171 (num_hops = 1); Tue, 28 Feb 2012 14:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=UsY68L2xoos45mCEC6VhUFV+vIg1RxR32b8Gk4JGDUc=; b=Fl3jpOYQXf8YTEgJ1p4bLc0KrwisuawLgqtClE2fz9mdalDgfOWYsfEneV9z/ZQ+Qd NFd3jOV+ZH3c3t71pjkYACNcMdZrFewUE6NVG3qRnX/THZuut8E+tpYZCHF6wdhRjUi8 8sNPI2TS5EAFMwiHeDEbLQdpjdlCm+du3ydQA= Received: by 10.50.197.135 with SMTP id iu7mr3938483igc.50.1330469854110; Tue, 28 Feb 2012 14:57:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.132.195 with HTTP; Tue, 28 Feb 2012 14:56:54 -0800 (PST) In-Reply-To: References: <01a901ccf622$0645f230$12d1d690$@alliantinternet.com> <4F4D108E.2030707@sugarcrm.com> Date: Tue, 28 Feb 2012 14:56:54 -0800 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=14dae934084d09e5a004ba0e27db Subject: Re: [PHP-DEV] Possibility to add finally to try/catch? From: ww.galen@gmail.com (Galen Wright-Watson) --14dae934084d09e5a004ba0e27db Content-Type: text/plain; charset=ISO-8859-1 A userland solution is possible making use of destructors to run anonymous functions (see How can I get around the lack of a finally block in PHP?). However, there are a number of issues with this approach (some are outlined in the link), and language-level support would be preferable. As for implementation, would it be possible to hook into whatever PHP has in the way of frame disposal? That approach would have one of the same issues as the userland solution ("finally" blocks won't run until the current scope is exited), but is at least a partial solution. Would it be possible to implement partial block scope? The idea being to add some sort of guard when entering a block with an attached "finally", so that when the block is exited, the finally runs. Please excuse my ignorance if none of this is viable; I'll do my homework now. --14dae934084d09e5a004ba0e27db--