Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100342 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13490 invoked from network); 1 Sep 2017 12:45:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2017 12:45:53 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.193 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.193 mail-wr0-f193.google.com Received: from [209.85.128.193] ([209.85.128.193:37996] helo=mail-wr0-f193.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/C9-04538-08659A95 for ; Fri, 01 Sep 2017 08:45:53 -0400 Received: by mail-wr0-f193.google.com with SMTP id j3so47892wrb.5 for ; Fri, 01 Sep 2017 05:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=Ijpg213dTnVHCNEne5UklC42hXs3KnP8Jt8rtihXgbM=; b=bP7+2VwfEgboEvKpMzqeWp6bTKxDPo5OJkZuFk/EL+DrJlr3If4QBqE+eMcFQiLXyM 4+h38ZeafqHfTmV++yJRjRjgbzJDcPBPkDDhidO3wMohTxZOlzovdSgYfGQ+vvg7eTpY H39v85LfKGf5UNTrWsM3zCWNGDupYjvKZGgK7HHaiBEOGnCIsGlBCgWn0vmeC12f6K/T cVA8bEFechKbWh4BrFG24ZKOfDVK57HkWmu+jThQM1BxFTDP33Ugr1Mz4ymc4o8NE2Yu gC153FOY0asCoK7o5Lljv7QpT9XZvtynoA8Sb4Pv0URJwpWmg4oJLCMp7W8wO6tyFwih 0abQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=Ijpg213dTnVHCNEne5UklC42hXs3KnP8Jt8rtihXgbM=; b=fe1BNhcvV1aR/J7Z2Svc5ZMXfcvi/EiljEi2x7j1Yvm0SS1bPEfIeu4d8piSjIAgDa rG5R6kXhfUeIXjUhpMTW3OtvhTZ2PR24UiqH1nGUKtRHwDqQcmxFf9mCD7lL8s7aH0Ev lwBvH1iki1Ms9YemLx8Yp6xneRl5lDjkC1It7AIZUPN2sWHBhudCuZlGFl+YkWILddEd /eZK+KsBa57eHOP7alcPQnUHqDGc9DrRUV/6NWxYpwijbBu9UyjE2OhptIIGjUT/6cJx b96SoS6Ly28VrQdVq+pK7Y7FQb1n5ggdmz2dQRfXsXTrkRVF+v1G9etwOAlcU2p7zb2h 0CBw== X-Gm-Message-State: AHPjjUjsjFNMOvwLg6uuYcgS8Ws0rmTHqitADGepxZevLozB2+GIHxKW mTLu5jO88vUy26bOJ10= X-Google-Smtp-Source: ADKCNb6SxrIwQkxcLrEj5Af1OSzIUHl36TF9+7nwNbTbX9eKAtNzQq5nldhYaevAcVPmYP747Jr4SA== X-Received: by 10.223.163.66 with SMTP id d2mr1129012wrb.157.1504269949744; Fri, 01 Sep 2017 05:45:49 -0700 (PDT) Received: from [10.61.55.165] (188.29.165.37.threembb.co.uk. [188.29.165.37]) by smtp.gmail.com with ESMTPSA id x69sm8248wme.34.2017.09.01.05.45.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 05:45:48 -0700 (PDT) Date: Fri, 01 Sep 2017 13:45:46 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <7E991FBB-C115-4AB9-B904-EBE7C0F24089@lvht.net> References: <7E991FBB-C115-4AB9-B904-EBE7C0F24089@lvht.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net Message-ID: Subject: Re: [PHP-DEV] add Fiber (sackful coroutine) support From: rowan.collins@gmail.com (Rowan Collins) On 31 August 2017 15:28:36 BST, Haitao Lv wrote: >So I propose to introduce the sackful coroutine, aka Fiber, support for >PHP=2E Hi! Is this your own invention, or is the name and semantics based on some exi= sting language or computer science theory? "Fiber" makes me think of string= s, rather than coroutines, so maybe I'm missing a key metaphor here=2E >> > function foo($a) >> { >> $b =3D await $a + 1; >> echo $b; >> } Should "await" be "yield" here? If not, what happens if I call foo() witho= ut being inside a Fiber? Similarly, if I run bar() and it runs foo(), what result will I get outsid= e a Fiber, since bar() has no yield, so is not itself a generator? >So the Fiber API is a little like the Generator API, but is more simple >yet powerful=2E So there >is no need to distinct $generator->current(), $generator->send(), and >$generator->getReturn()=2E I don't really follow how merging the current() and send() methods is rela= ted to whether the coroutine was paused further into the stack=2E Your ->re= sume() doesn't seem to do anything a normal generator can't, except that th= e yield is nested deeper=2E Nor does it seem to replace getReturn() (althou= gh I struggled to understand the rationale for that addition at the time, o= thers swore it was necessary)=2E Meanwhile, how does this relate to other ways of combining generators, suc= h as "yield from"? I do struggle with coroutines, so I may be missing something obvious here= =2E Regards, --=20 Rowan Collins [IMSoP]