Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60820 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62713 invoked from network); 14 Jun 2012 10:16:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2012 10:16:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=ab@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ab@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.73.107 as permitted sender) X-PHP-List-Original-Sender: ab@php.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:59703] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/E2-39100-81AB9DF4 for ; Thu, 14 Jun 2012 06:16:59 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id D3D8B9146A1; Thu, 14 Jun 2012 12:16:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on h1123647.serverkompetenz.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.5 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable version=3.3.1 Received: from webmail.klapt.com (h1123647.serverkompetenz.net [127.0.0.1]) by h1123647.serverkompetenz.net (Postfix) with ESMTP id 388D19145C1; Thu, 14 Jun 2012 12:16:50 +0200 (CEST) Received: from 88.66.254.240 (SquirrelMail authenticated user anatoliy@belsky.info) by webmail.klapt.com with HTTP; Thu, 14 Jun 2012 12:16:50 +0200 Message-ID: <5647ebd1a16d44f9630e471d44509678.squirrel@webmail.klapt.com> In-Reply-To: References: <18e2afd236c1f0c5901824fa6ab5e9f5.squirrel@webmail.klapt.com> <4FD7AF94.5000503@gmail.com> Date: Thu, 14 Jun 2012 12:16:50 +0200 To: "Nikita Popov" Cc: =?iso-8859-1?Q?=22=C1ngel_Gonz=E1lez=22?= , "Tom Boutell" , ab@php.net, "Laruence" , "PHP internals" Reply-To: ab@php.net User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Generators in PHP From: ab@php.net ("Anatoliy Belsky") Am Mi, 13.06.2012, 00:06 schrieb Nikita Popov: > That's how it is currently implemented. The generator backs up the > current execution context (execute_data, CVs, Ts), pushed stack > arguments and several executor globals. When the generator is resumed > everything is restored and it continues to run as if nothing happened > :) > > Doing context switching using setjmp family functions seems to me like > a really scary thing to do. I don't think that one can do that in a > sane way. I see what you mean but would disagree :) . Working with the php context only brings only a structural advantage. IMHO practically it's comparable with a pure php implementation. Where it might be ok for generators as the lexer must be touched anyway, I was talking about the base for spl_coroutine mentioned by Laurence. Also, some sane implementation do exist. Not only oss (see the links in my previous mail), but even in the premium products, just to be said. Of course it's complex, but doable, may be not right at the first step. Anatoliy