Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59327 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92338 invoked from network); 2 Apr 2012 19:57:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2012 19:57:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=ww.galen@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ww.galen@gmail.com; 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:49063] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/A7-43049-1940A7F4 for ; Mon, 02 Apr 2012 15:57:05 -0400 Received: by iaeh11 with SMTP id h11so5263322iae.29 for ; Mon, 02 Apr 2012 12:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=DYgsOCxBdWADUNluqSV0M0u32k4bmtjqR8C+q1EYLws=; b=dyCP2slQsY4sJsBl95R7+sTjCOPxsxCPYalon4J620kamjzIM0uQXj8jSmGScHj7Y7 vXZiA0vnnbhxDpyIoo48da6V/XiOJcy2kGWaDDsCTEbdLCRjh1rUUS7HzGBM9t6enL3T /ijUzeRIVxM6y9km47aP1ApZT/a5sgDio9a4xTkRdbh8zmijH8ZUXHCjdFsgiouWNIv+ 6+SZd8Pa7NMq39u2YinYCwp/q1JIocm0dRvcK7B5l9b/vuMqtlKGLwHid/rYvvgCbbO4 5x08pShEaEPrpmCpecUaROm337fNYyr7d1WpR1N2goCXqj639UANwBAn3A/qFtkAeqHq 3r6Q== Received: by 10.50.159.202 with SMTP id xe10mr6638797igb.66.1333396623169; Mon, 02 Apr 2012 12:57:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.164.132 with HTTP; Mon, 2 Apr 2012 12:56:22 -0700 (PDT) In-Reply-To: References: Date: Mon, 2 Apr 2012 12:56:22 -0700 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=14dae93406011196f804bcb7988d Subject: Re: [PHP-DEV] resume after exception From: ww.galen@gmail.com (Galen Wright-Watson) --14dae93406011196f804bcb7988d Content-Type: text/plain; charset=ISO-8859-1 On Mon, Apr 2, 2012 at 5:44 AM, Rasmus Schultz wrote: > I was just reading about the new async/await keywords in C# 5.0, and while > this has no particular relevance to PHP as such, it got me thinking about > this idea... > > What if you could resume execution after an exception was thrown? > > This is beginning to sound a lot like Common LISP's conditions, which isn't necessarily a bad thing. To get it to work, PHP would have to preserve the stack when an exception is thrown (until the catch block is exited), or store the exception/condition handler and execute it when the exception is thrown/condition is signaled before unwinding the stack frame. > Taking this one step further, imagine it were also possible to serialize() > an Interrupt - and resume it at a later time. This would open up entirely > new possibilities for (AJAX) web-application frameworks, which would be > able to suspend execution, serialize the script state, return a response, > wait for further interaction from the user, and then resume execution. > > This feels an unnatural use for an Interrupt, which models messages between different levels of the execution stack. What you're describing is better done with continuations (PDF), where you have an execution tree rather than a stack. While continuations would certainly be cool, there are definite performance and memory usage concerns involved with the various implementations . --14dae93406011196f804bcb7988d--