Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113598 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38817 invoked from network); 18 Mar 2021 09:26:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Mar 2021 09:26:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 75F0F1804F6 for ; Thu, 18 Mar 2021 02:20:23 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 ; Thu, 18 Mar 2021 02:20:22 -0700 (PDT) Received: by mail-pj1-f45.google.com with SMTP id ha17so2600246pjb.2 for ; Thu, 18 Mar 2021 02:20:22 -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:content-transfer-encoding; bh=uA5kU8hpek3eVJexm0wtBRVNvWc3CcLtUolVT/v99OI=; b=AUsn5tDUr5zF/+OgWRDEowZmnIZf8Kk5nNqPXSBRCXdBECH5EjcKI7p8k/cBshFyfy X9hAoNuA8Qfuoh1cav+uPFDm+FnOafvvc07le3sVyfdKe3r2Avpv0Cr64SMTE23nI8Mk g2IlkaOA8/0ZwoCkGZI4hCTESLbY9R8w4zX0GuM0Llssywv8fBuG3LaNObgd9RHjcjOs HfFtQUOwa312kf16XN/udR8AIkIiOOjvZVu2y0gdNws2F67RiA6exe9WFcRQx+F80XRA PRn/+5nPXxstYvdEyr6DFS/VvVd2mn4MLYOq4LIAkC836lCjdcwjNlHKp3I3nYsCtDqf NZGw== 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:content-transfer-encoding; bh=uA5kU8hpek3eVJexm0wtBRVNvWc3CcLtUolVT/v99OI=; b=Z16GkiVkvJBkIseKJ+kjcWThc9XmCwXp/x9ZxMz1buREJMkMLzPYcXDVdjvaS8vMVb gTszFsHu8PU3jcyb/9Tes6IA26RgcRMohTApJfS+kQaTUSZxwg76HPmx79nMYn6t0fOn dyERsrrtC/Vwba0vGTBCU/lKxiE0wZQaLNRMiejmi/l5a5zvQbbfAfGKuKTWcJkTTtVY kys/OM4wrGoCdNwwoMisjWKt9pw43lj0l+ljquHVGs/xjM8r04F8yyI1DLbfVzyCTHxA IARFzIwSoClxseyZdjSc49AE8OYDziV20oaNuwizgEGZE/n4r9KuOPywi9yY0aOkVNh9 b6+g== X-Gm-Message-State: AOAM532OZ4CQ997TL01EAfb4NOL2XtSxJU7zLHbzmm3jyJPXfFNqlwTp eEaSRV8CWQ8pYJjEbrifiu3bAMU+tPlesqvnmMQ= X-Google-Smtp-Source: ABdhPJzULaOQitNSaR/1cfoSUaV/hLKy7VK87oV4CcjRfMl9N96r5VB8typsIBUJrOfmdSkStPqpNysMyauFKO8eADE= X-Received: by 2002:a17:902:dcd4:b029:e6:5398:609f with SMTP id t20-20020a170902dcd4b02900e65398609fmr8612048pll.58.1616059220121; Thu, 18 Mar 2021 02:20:20 -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: Thu, 18 Mar 2021 09:20:08 +0000 Message-ID: To: Peter Stalman Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] Fibers From: joshdifabio@gmail.com (Josh Di Fabio) Hi Peter, Thanks for clarifying. On Thu, Mar 18, 2021 at 2:43 AM Peter Stalman wrote: > > On Wed, Mar 17, 2021 at 7:41 AM Josh Di Fabio wro= te: >> >> 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 th= e race condition caused by async, and the other is if the top level code ex= plicitly states that it is called asynchronously. > > When I used the Guzzle `requestAsync()` example, it was meant to show tha= t 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 `setTransacti= onId()` 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 wit= hout 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 i= nside 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 c= alls. 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 `y= ield` keyword in front of them, the developer cannot be unaware that they a= re inside an event loop that can resume fibers. > > I am arguing against you saying this RFC is "very dangerous", because thi= s feature can only be dangerous if you use it. It's like saying `exec()` i= s very dangerous, because you can screw up all sorts of things with it. Bu= t it is only dangerous if you use it without knowing what you are doing. > > Thanks, > Peter > > I understand your view; it's the same view that others have expressed here including the RFC authors. I believe it is fair to paraphrase as, "If you want to enable fibers in your application, you must be confident about the implementation details of all of the code in your application, including that of your dependencies, which are written and maintained by other developers." I don't have anything to add to my previous point in that I disagree that this is practical. Thanks