Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113597 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19665 invoked from network); 18 Mar 2021 02:49:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Mar 2021 02:49:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F08051804B8 for ; Wed, 17 Mar 2021 19:43:41 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 17 Mar 2021 19:43:41 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id o10so2105849lfb.9 for ; Wed, 17 Mar 2021 19:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XuiAHvSRMajR1oCeWFylTszo9SsorWmTixiHR3ht92o=; b=K5sp5mIbvnybZ9Uy4nBgW3xeVbaqs0rkZXt9Q7nplV0bxWS6uRqiTE0Xztu6uoDg3z aQCS/M1DQH6Lh3zcsTJeyn+QpognqX4yMStnov8MkSaqD8ATCqp5XPZ6qTh2W95/V3P3 41Yx7KVRnHv4YF0E6YXsuQumE7hIgtMcQ+b1svlQU+oglZ8mKqxIUu4uT8cnIEQWgdsl R3QE58USyOAgNA8R2q6DVjX49Pu1eji7POJX29b5rw0VuMWXKwXPolNgg3U7LJtsq0vX WTr3srdhbHFeNTCSPmGpRoWCaAhPzgy8XQpfCszyu+uchqgUyB3tYdzdphfcT+PTvxfp pzoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XuiAHvSRMajR1oCeWFylTszo9SsorWmTixiHR3ht92o=; b=ChIyEH9SA6RWTGKBDQjG09MJL9QiG1fD9/fXsCBhwjMSBE/vILY4wy2aU0ysF4GWQe kMWnV1Wihfpj9tsqzeU4ATA4vy77VsPhEImkMFRWJzJCSjwsJ3zhIWwURq+IF7WT5Zxs DJqIsA7uGRXlAGQKTddwEZxbakdKBAMDp1bpJ6RrI/1SGznNimEn/HJVhgorf2Fvh7ey zFzt0IqRKGxWZTSGxKPeANfZ1OefKGTS9BEn+yxc24OsU0tGugTMXKwYFlJoLB3KuY5R c1CcL0NHsM6KGE6slXtwGdFi5Y48Hkg9C6sOkmhTaUwWQQuraV9/p7b5GEwYvXuTRIQi zToA== X-Gm-Message-State: AOAM530G006wxy8/JZFiWi9jRIvkEih8XFh40ch493Q6KwiJRjGoSG5c yNUo2uEigSq7CD/oH/XtwMPhjQOlsLgZpkH+1gk= X-Google-Smtp-Source: ABdhPJwiGCairh2GMUPINSHtjfq3DjEj5khBuSbjrxGarK4qPD4U6njEjLZ6yCixSOaYmGY9bsOblIRSVAZiMfIX1H0= X-Received: by 2002:a19:c14c:: with SMTP id r73mr4114826lff.581.1616035419696; Wed, 17 Mar 2021 19:43:39 -0700 (PDT) MIME-Version: 1.0 References: <70951423-5e77-c150-6dce-dd3c62f8dc8b@php.net> <0b994a60-7970-605b-1657-d6ee732690e5@gmx.de> <5C73A1DE-E563-4F69-B8C7-6506F81D7345@trowski.com> In-Reply-To: Date: Wed, 17 Mar 2021 19:43:28 -0700 Message-ID: To: Josh Di Fabio Cc: php internals Content-Type: multipart/alternative; boundary="00000000000022b33605bdc69151" Subject: Re: [PHP-DEV] [VOTE] Fibers From: sarkedev@gmail.com (Peter Stalman) --00000000000022b33605bdc69151 Content-Type: text/plain; charset="UTF-8" On Wed, Mar 17, 2021 at 7:41 AM Josh Di Fabio wrote: > Note the difference between the two. Also note how, in both of the > above cases, the asynchronicity is explicit and the developer has > opted into it. Both of the above are different approaches to that > being proposed in this RFC (this is a design choice by the authors). > Hi again Josh, I think we are jumping back and forth on two different things. One is the race condition caused by async, and the other is if the top level code explicitly states that it is called asynchronously. When I used the Guzzle `requestAsync()` example, it was meant to show that you can have a library do something, and then continue execution like it had completed when in fact it had not. This could cause your `setTransactionId()` to happen before the `capturePayment()` request has completed, and in that regard it can be the same; not by how it works, but in concept. I do know that they are different in implementation. It would cause this without an explicit keyword showing that `capturePayment()` used an async call internally. That is what I was referring to when I said it could also be a race condition now, without fibers. As I was also explaining earlier, the developer must know that they are inside an async environment, because you can't suspend the main "thread". `Fiber::suspend()` only works inside of a fiber, and for that to happen you must have run it inside of a framework that can schedule and resume these calls. To reiterate my earlier point, the average PHP developer will not be in a place where this would ever occur out of the blue for them. It's not going to surprise them, and even though it might not have an `await` or `yield` keyword in front of them, the developer cannot be unaware that they are inside an event loop that can resume fibers. I am arguing against you saying this RFC is "very dangerous", because this feature can only be dangerous if you use it. It's like saying `exec()` is very dangerous, because you can screw up all sorts of things with it. But it is only dangerous if you use it without knowing what you are doing. Thanks, Peter --00000000000022b33605bdc69151--