Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128915 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 8BEC01A00BC for ; Thu, 23 Oct 2025 05:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761199026; bh=wy0uJj34T5pdrcwFHMtgzHIiyjeegkGXJ0g5mw0kun4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Z67CfBX4uSB9fp4rhE2OBg71SnHtziOVrDmn78NdGizkq+5Fkn+TCOkUtEoRSoSU+ IEtxU2uUtBOE48FNeOsUUGfqpDUSQjPICe25/onSqtbqvMmQOlwGMFcKmWPLwaptr/ a8oAvsdkK82YYnHlqinUTKcVOEZb0aUIFs6Bja2Vtksgbk8AsjCpkZvxHw/hubv3xk J0kFbEVAKVHtndKc9bACG08rmaF8I+SgH7z7k+WAA/yB4PuCnd1O7vIGPYkJU3Lc1l 9IYAfHiKMLHX9d/cIEk/xXeYBJ7Yt1vWohGQPpcKB/ncDS4Hw4WVJ1z1O6EV3B975p t7RpRPdXSjP6w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4533E18006E for ; Thu, 23 Oct 2025 05:57:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 23 Oct 2025 05:57:05 +0000 (UTC) Received: by mail-vs1-f49.google.com with SMTP id ada2fe7eead31-59dff155dc6so263952137.3 for ; Wed, 22 Oct 2025 22:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761199019; x=1761803819; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wy0uJj34T5pdrcwFHMtgzHIiyjeegkGXJ0g5mw0kun4=; b=GZN16CTizs2Qu9N04beUJsNYeGFrxCno3OIzMN1Dz7MetEAExPRszKQR3yNbC+FlwY K6Q73uT9RBXXfl1tXbtMoPnuK+gLFViwfxJc7D9Gl3ucIQqscXXrzBRwJiGuar6hxu5w ep9TBPSr2YDxUehjiAQgd4IWXjnf1GZm8XBjxpGgl6CODLXM+wGzaL0B01qJ4lQWyGnK 7DAvCQ74P9lQve4AR6iC/msm+ApHHqtijtGvH0VmKIz3SVX+xUXCAYpPXleiv+h9G7KB t0EVuGY9NwKsPh8NnMJlk12pv/+vlKzX3lAIJOd4tzGuQ1TMir+s56PGVqi/XEP8gQdi 8i5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761199019; x=1761803819; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wy0uJj34T5pdrcwFHMtgzHIiyjeegkGXJ0g5mw0kun4=; b=aWWWarMbnEZrZhMaYvBBC4U+vJ4UmU88lHDBWywNdsnXKzyYW2trZjDWE1oCsmDb2N BCv6aHPRsnq62s1EqVCICzT3NO+n6RacZGrDyk21J8B8T12G4yoCOiboNAvEWKBc3J+G kvzPzHFIVKTtZszR1N3jRvCLz3gpFPHvH9/NTcDoVkAPNnEH4D3GIOrNr/n7X95SQmmH BwstjrBVkCF0DxbFcACSMo1saYN5LxWiYUimdq6P6P29J86zah12lEDD3zHlQm0KJnYS d70VAQGUIRs3gXK0Ye2XVH7JOej01IC6BtEI/C1XaxbquQeJrkClm8feJTsdUOU4moFD mvGg== X-Forwarded-Encrypted: i=1; AJvYcCV8JLk/zIB8rZTGovnzKfO4aU2AAI5jQHxtF+KJpu5LhHaZYDzc8Z4jseodtqna+tqnL25kWiE1Pl4=@lists.php.net X-Gm-Message-State: AOJu0Yz5ze2SBLCncv1CIvV+oaSqwlkn2/kupH4GXwmrUQMp+MDRiqyF pjiFk0rs5KWEwqMZZxaGIlRu3KcuIXH19wIINBvHmA3kf7TE5dqcjab6ILLPyMDI8GksFLy4dkv uiCCpFL/PdxdtM9QS0PSiuJRoeARy9lM= X-Gm-Gg: ASbGncuxUC1Rkm3esjRQUzV20mZ9QZZpC/K8h5PyT08SO3/MTk9GabsawcXChZsioQj v3rfvKXxsZ17z3tnPfWp4nLXdMNnJPN2EbvGtVJL7bi2G4EVDDE3s1iOWRY66SXibc20ojhRScT kxk0Sp9aLFgPe/8wU7pBRiqA5x0QA66Lxe97ZraZOFN+Y1CijyDLTGFOglHfhGw4F4deKY+vPHr OvXoSQMX+49mcouRBmeV008bGYagiwMOoiy/UPmzYm8EvEnIi60IuFqMdGQ9Nh7i/Gk5uixbQl4 goC623zxNkJz4GgAJ6L8SDwxrg== X-Google-Smtp-Source: AGHT+IG0AiSGnkLZATDcs7NxGZEcWnBYKhY+QRJB93BuAZ0tXT48hknh7YBIweoSEUpsndNE1nvSEUHNvw0ZSSBGe3Q= X-Received: by 2002:a05:6102:a47:b0:4e6:edce:4b55 with SMTP id ada2fe7eead31-5db2e446b41mr260385137.4.1761199019175; Wed, 22 Oct 2025 22:56:59 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <0e4e39d6-9cc9-4970-92e0-2463143b4011@app.fastmail.com> <37180d8d-85b4-49a3-a672-334bf4329470@app.fastmail.com> <2f8524a7-dea2-4fbf-933a-c538d3706253@app.fastmail.com> <151800a7-1094-49bc-8e43-c593a74741af@app.fastmail.com> In-Reply-To: Date: Thu, 23 Oct 2025 08:56:48 +0300 X-Gm-Features: AWmQ_bmC0Xeesw4Vy694O6-pqThSGxQeomMc5K086VIGpBG4jHYMQGI_O9Lc0sA Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC Stage 4 To: John Bafford Cc: Rob Landers , Aleksander Machniak , PHP Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hi, > it makes that future RFC's job unnecessary harder If you want to make PHP multithreaded and plan to change the language syntax while avoiding future issues, it would be reasonable to discuss the changes using specific syntax examples. Can you show me the cases you want to implement? > I can't find where this `awaitXX` function is defined It was in the third version of the RFC. > So you say "Awaitable objects do not return multiple values. 1. multiple values: ```php $fs =3D new FileSystemEvents(); // At that moment, the user created file1 and then file2. $event =3D await($fs); // Now: $event contains [file1, file2] -- The coroutine captured two events at once. ``` 2. signe value: ```php $fs =3D new FileSystemEvents(); // At that moment, the user created file1 and then file2. $event =3D await($fs); // Now: $event contains file1 -- ONLY ONE VALUE! ``` > but to me it feels like you're just dismissing Rob and my concern It=E2=80=99s hard three times over, because the expression foreach(await() = as ) is considered valid only if await returns a value once. > And Swift does recognize this as a problem I don=E2=80=99t know whether Swift actually recognizes it as a problem or n= ot, but it actively uses syntax to describe contracts. And that=E2=80=99s a slightly different level of control compared to just functions and interfaces. Let me repeat the main conclusions: 1. There=E2=80=99s no problem making `FutureLike` the base interface, which would guarantee the idempotence of the data source. 2. The benefit is that calling `await` twice would become more predictable (although the data type would still be unknown). 3. However, we would lose an interface that describes the real world as it is, and the programmer would lose some flexibility. 4. Yet, considering that non-idempotent `Awaitable` objects, while allowed, are rarely used in high-level languages, this may not actually be a problem. > Then, just saying, this is a place where people are going to be confused,= and it needs to be stated clearly. I don=E2=80=99t mind; I should take a look at this point. > btw, if you haven't read through the Swift Evolution proposals for struct= ured concurrency, Thanks for the idea. I haven=E2=80=99t read that discussion. Is it https://forums.swift.org/t/se-0304-structured-concurrency/45314 ? > What I'm proposing that specifically Async\protect() and *forcibly* cance= lling coroutines should be removed. This RFC does not include forced coroutine termination, only cooperative cancellation using exceptions. If we remove the protect function, we=E2=80=99ll also have to remove cooperative cancellation. > You'll note that in some multithreading APIs, forcibly terminating thread= s, while allowed This feature was implemented in Swow using the VM interruption mechanism. That=E2=80=99s why I wrote that such a solution is possible if someone need= s it, but it has nothing to do with either protect or cooperative cancellation. > The RFC should include a description of _why_ cooperative cancellation ha= s been chosen. If I add detailed explanations for every _why_ in the RFC, it might never get read :) Thanks, Ed