Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60749 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56838 invoked from network); 6 Jun 2012 02:43:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2012 02:43:07 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:42455] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/D2-46677-BB3CECF4 for ; Tue, 05 Jun 2012 22:43:07 -0400 Received: by vcbfk1 with SMTP id fk1so4190817vcb.29 for ; Tue, 05 Jun 2012 19:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=qz9BMqqalRCMQGfUCiG2IFuE6NsyM99G3BFybl9RIlc=; b=ROy5nW4ObRC+bVMSPsueQZ6wQyczdCpSHQBGB2gX/XHol6u1qxZzc/C5qDnFd6/I7Y 3OuXxo4z0CSDw0eNDjoBn2zOo9VJBqXQF3ue7MO12cXDIsdxW8OqrBsO/j8yTJGJAbTX NupBDzzRrVrSPFyaNM/H2JBo0aI0DGuXQtNPEJ6CjzRrOrzOMpbtVYqG9qiJe3gqEdDs iOHdkIsAp2/cgHfhOaMvec9BuM77JsNA81Fpmy555sJKyM2dOqM7NUFn6AOmKfV3wfeL n2u5B7opNGsDAleJVeOTjhhwIYi2Hr6RLvY5K7lZ0GGKkdHtlf6LGn2Jg84Vh4iS+4uk ueOw== Received: by 10.52.88.176 with SMTP id bh16mr16452434vdb.132.1338950584489; Tue, 05 Jun 2012 19:43:04 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.162.141 with HTTP; Tue, 5 Jun 2012 19:42:44 -0700 (PDT) In-Reply-To: References: Date: Wed, 6 Jun 2012 10:42:44 +0800 X-Google-Sender-Auth: lZpQoWlIZpwW0ZDZqWqec6ee59k Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Generators in PHP From: laruence@php.net (Laruence) On Wed, Jun 6, 2012 at 10:27 AM, Laruence wrote: > On Wed, Jun 6, 2012 at 10:15 AM, Laruence wrote: >> Hi Nikita: >> >> =C2=A0 =C2=A0the most important part to me is how did you implemented `y= ield` >> keyword, =C2=A0 is there a whole patch file I can look into? > Nervermind, =C2=A0I will check the branch out later > > thanks After a quick look, I think the main idea should goes to two parts: 1. implement yield (Zend) 2. implement spl_generators but not generator class (Spl) then we can implement spl_coroutine later base on this. what do you think? thanks >> >> =C2=A0 =C2=A0what will happen if you use a `yield` in a normal function? >> >> =C2=A0 =C2=A0actually, =C2=A0I tried to implemented coroutine, but since= I could not >> find a way to make zend_execute interruptable, then I didn't make it. >> >> =C2=A0 =C2=A0so, I am really interesting of this tech-specific :) >> >> thanks >> >> On Wed, Jun 6, 2012 at 1:35 AM, Nikita Popov = wrote: >>> Hi internals! >>> >>> In the last few days I've created a proof of concept implementation >>> for generators in PHP. It's not yet complete, but the basic >>> functionality is there: >>> https://github.com/nikic/php-src/tree/addGeneratorsSupport >>> >>> The implementation is outlined in the RFC-stub here: >>> https://wiki.php.net/rfc/generators >>> >>> Before going any further I'd like to get some comments about what you >>> think of adding generator support to PHP. >>> >>> If you don't know what generators are you should have a look at the >>> "Introduction" section in the above RFC or in the Python documentation >>> at http://wiki.python.org/moin/Generators. >>> >>> Nikita >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> >> >> -- >> Laruence =C2=A0Xinchen Hui >> http://www.laruence.com/ > > > > -- > Laruence =C2=A0Xinchen Hui > http://www.laruence.com/ --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/