Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59339 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63560 invoked from network); 3 Apr 2012 07:28:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2012 07:28:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=reeze.xia@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: reeze.xia@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:40391] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/51-54877-F96AA7F4 for ; Tue, 03 Apr 2012 03:28:32 -0400 Received: by iaeh11 with SMTP id h11so6070970iae.29 for ; Tue, 03 Apr 2012 00:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type; bh=YD/hxzN7/wYBjvk5EwRQetkBRVLl6idpuM3om6534lM=; b=l3qlzurXtOnEazSJ6p64n37IL1DTIKHZlWsItJqHXH2xg3md2IpkZ6N5eY3aliyUl+ VRekwOpb6DoMYWpn5tpD16rcD6QuMUxWiOhwvu7Q/XZUlKxQgas0GgkHD/m+upqjOdCJ p6U8E16YgQ5OnkOAWXEoQVhQlkav4cZFeu45Sla8vuwAdnr8lRH08ELIsjK1m5lDibFy 4XfDTXlxBhQ/hYFuKDA1FWhWc2m2FVaSbgtd9CVvsfNPD+uSF4DyrgZtTTEm/zibcYwL 9UfO0+F5GLAZ7kolyxaORhM+mlYbKs7wll+4mj0AXEwvgCky7ullskQh+ToNhaViCgVa dJfA== Received: by 10.42.145.72 with SMTP id e8mr6435020icv.0.1333438109482; Tue, 03 Apr 2012 00:28:29 -0700 (PDT) Received: from MacBookPro.local ([117.79.232.249]) by mx.google.com with ESMTPS id a10sm10578823igj.10.2012.04.03.00.28.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Apr 2012 00:28:28 -0700 (PDT) Date: Tue, 3 Apr 2012 15:28:29 +0800 To: Rasmus Schultz Cc: internals@lists.php.net Message-ID: <2FD77C3003DC4656BCF6309B097DD978@gmail.com> In-Reply-To: References: X-Mailer: sparrow 1.3.2 (build 814.60) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="4f7aa69d_5b25ace2_be4d" Subject: =?utf-8?Q?=E5=9B=9E=E5=A4=8D=EF=BC=9A_?=[PHP-DEV] resume after exception From: reeze.xia@gmail.com (reeze) --4f7aa69d_5b25ace2_be4d Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline If just for exception recovery how about implement ruby's retry =3F =20 http://www.tutorialspoint.com/ruby/ruby=5Floops.htm Ruby retry statement= section. =E5=9C=A8 2012=E5=B9=B44=E6=9C=882=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=80=EF= =BC=8C=E4=B8=8B=E5=8D=888:44=EF=BC=8CRasmus Schultz =E5=86=99=E9=81=93=EF= =BC=9A > I was just reading about the new async/await keywords in C=23 5.0, and = while > this has no particular relevance to PHP as such, it got me thinking abo= ut > this idea... > =20 > What if you could resume execution after an exception was thrown=3F > =20 > =46ictive example: > =20 > function test() > =7B > echo =22Begin Test=21=5Cn=22; > =20 > throw new Interrupt(); > =20 > echo =22Execution resumed=21=22; > =7D > =20 > try > =7B > test(); > =7D > catch (Interrupt =24e) > =7B > echo =22Execution interrupted.=5Cn=22; > resume; > =7D > =20 > The output of this would be: > =20 > Begin Test=21 > Execution interrupted. > Execution resumed=21 > =20 > In other words, Interrupt is a new type of Exception, from which you ca= n > recover, using the new resume keyword. > =20 > Taking this one step further, imagine it were also possible to serializ= e() > an Interrupt - and resume it at a later time. This would open up entire= ly > new possibilities for (AJAX) web-application frameworks, which would be= > able to suspend execution, serialize the script state, return a respons= e, > wait for further interaction from the user, and then resume execution. > =20 > I'm sure there are lots of problems with this idea, and perhaps it's no= t a > good fit for PHP at all, but I figured it couldn't harm to put the idea= out > there anyway :-) > =20 > Any thoughts=3F --4f7aa69d_5b25ace2_be4d--