Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129384 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 2A4D61A00BC for ; Sat, 22 Nov 2025 07:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763796031; bh=UU+J+1K59D4VZQqGHi7MPtzV9LL4auZDDnTUC9AhS1E=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=IoTA0zqbZqwyASY9LRxeENBsS4sB4EXreeEx67lXpuMa6eu4Regi6VqToFvYo8Nhg 2hBuNYmgxdm69Xz2V/95xrggw+O7F5ymH0Po+kVAC+q5JnZlW+CTWuA2acD5PURtlf pF2sewFwbLVQ1HIzk9dTtAJr2G9STBepMwFxLmtW1Rzok2q3IYKO8LmyoWo8qVgiAL 8ymWEf0i4D7jig8vfdJrNDSXMIhG0qpFQNYg/OiMQSd8RWGXouDgx0LxQOl/9MSFwl GSlB43BumYwwJY9CBPvtGpJs8Qd5QH73z7NRumSQtJROITcMKUqpKkLaZwsOnasBVs GmTP4HJlRXIOw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 109CE180040 for ; Sat, 22 Nov 2025 07:20:31 +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_MISSING, 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 mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 22 Nov 2025 07:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thomasbley.de; s=s1-ionos; t=1763796023; x=1764400823; i=mails@thomasbley.de; bh=UU+J+1K59D4VZQqGHi7MPtzV9LL4auZDDnTUC9AhS1E=; h=X-UI-Sender-Class:Date:From:To:Cc:Message-ID:In-Reply-To: References:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=GfUMsD7wvi4Qqf4EWIqC2rMTA4+xS4o3728rKjdwlo+ukY7UVRSv1TwKzZ8V3med uQSBN/TI79J3n27cQ54Kiz+E6K0VLFrX5VQEYOGTfvqsNCcUgf04hDk+/1rc9zMRJ zYQagmd29nKUIGXAwZxD2187P0rjwRaCf4xDHWF1px27QrSxYiEgtwzlgn3Qcu0xy UpA6UIuO0Z9VWSd7FS2cBA6ctIyKkwohtrLn2OnRlLM0TAmrkxv14SuGztWtq2TFY oBWFKyjL/pwtwfhdQ1vGJ5945iKqDokwEAVasBnFP7fHz0CFBl318XC2YMc2rkMK/ VrINcpiQVmDMzJafuQ== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from open-xchange-core-mw-default-22.open-xchange-core-mw-hazelcast-headless.open-xchange.svc.cluster.local ([10.73.157.88]) by mrelayeu.kundenserver.de (mreue011 [172.19.35.3]) with ESMTPSA (Nemesis) id 1MbRwP-1vxygA0kBd-00iGtr; Sat, 22 Nov 2025 08:20:23 +0100 Date: Sat, 22 Nov 2025 08:20:22 +0100 (CET) To: Edmond Dantes Cc: internals@lists.php.net Message-ID: <691963327.399484.1763796022993@email.ionos.de> In-Reply-To: References: <383528143.397454.1763760932585@email.ionos.de> Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v8.38.93 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K1:uHaTtgex+cB+IWPz37bmuGCB8aLPwIB+hHd+3I9bGKtgI7XouZd szmWihqpIoT61i57YCOLry9Ohudxd99WMnkk/X0nwfj6y/c1o6Jve/82y9EX2Z6eJ23F/Dp 2dWbL2TwFNk/sdRlKQ3UNCp0GSzMW7j43aCeyM6rJaUH9YT7DluVsvgwcyUpCn5gDeRfj5T ENhvEmSx6E2l2CbDRLRmA== UI-OutboundReport: notjunk:1;M01:P0:DlJGX0N7oA4=;YlMNxdjrHF5r6iAf8ahBvlzaht2 M9NHVJaxdYIBXjcETr74euZau7/7PmTRgab5aJ3P3hvq5zio7mgIWNx6diaZ/2aOUgOUYMtGL Oaa0edcYSgEa2ebmgZCpoimRFrZtRlk2oA6xWJVf4XEaAGTvzQhn130Z5ouMAvzbSU5IbuTly vc1TuFYeYeGbAOgYE0ovZUSn4708xiNJCPJoz9urypvjUzxjwNt0VB0whOp30s+vnOzT6I3XZ A7sS3s4vlsAwRFVCKR7P7r64/3ccHOPdVyU7a4eGk9ZDXJ5VT5stQg2p1VE/WiK83Y4C67h4o SI2nd/L2YF0CdYmEstdaJmIoH6vuVReBzXgZdyENoBl+QzNfAJeqj5ZJWCoSE4XLIlSrEIlIW oJRrCTblpwzKs7s0o4bbsErmkMT/DC179RMwEYFmHVY/QItpBsb42941fiKONGt5RAzW+ph7E UgKcsklmjn54KSk8PzzJmefU2PF/aMqt+5T6lR1l/4vq2mdc4J7MF4WhG9g0yoU379I5hCLft cX3IPHSulzAplTOy2tkHrVUJJvOC2JpY5yKrdmtUA39o2pbYX6BAfcw7OtO0UeR1/wXNLOYwO 2/gEi98e8rWcmkfpXPes3roa7xGjp9sjoLOyMr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ccWrAuBY06CsP/SrBupaoaHFdy6sDMDjEBAZEYAn7tRduvu2AVeed8PzTA5Rd4VF WN4zeeavOslQn From: mails@thomasbley.de (Thomas Bley) > Edmond Dantes hat am 22.11.2025 05:17 CET geschrieb= en: >=20 > =20 > Hello >=20 > > from userland perspective I would prefer explicit declaration on each u= sage of async over declare(), hooks and INI. This would make reviews, stati= c code analysis, etc. easier. > > RFCs can be written in small parts for each new function, e.g. >=20 > This solution has the following consequences. >=20 > We have a REST API project that is 10 years old. Recently we learned > that PHP 9 has been released, and we can improve performance. To do > this, we need to: > 1. Migrate to another web server. > 2. Wrap the request-handling code in a coroutine. >=20 > However, it turns out this doesn=E2=80=99t work. If the code inside the > coroutine doesn=E2=80=99t yield control, then there is no improvement at = all. > And we=E2=80=99re like=E2=80=A6 this technology is useless. >=20 > And then one of the developers says: =E2=80=9CGuys, we just need to renam= e all > functions to _async and it will work.=E2=80=9D > (And he=E2=80=99s this young optimistic perfectionist programmer who says= : > *=E2=80=9CThen the code will be beautiful, amazing, and blaaaaaazing!=E2= =80=9D*) >=20 > Everyone happily writes a script to rename 30-50,000 lines of a > many-years-old project. New bugs appear. But we fix them, hoping for a > better future. > And then it turns out that after renaming the functions nothing works, > because shared memory has to be removed. >=20 > In other words, the team spent time on refactoring, and in the end > they still had to do the refactoring that was unavoidable. >=20 > What benefits did the developers gain? > 1. Did the code become clearer? Yes, the code became a bit clearer. > It=E2=80=99s visible that the functions will yield control. > 2. Did the number of bugs decrease? > 3. Did the amount of code changes become smaller? > 4. Did API segmentation appear? >=20 > People won=E2=80=99t rewrite code unless the business is at risk. And eve= n > then, very often no one does anything. Therefore, the **more** > complicated the transition to asynchrony is, the **less likely** it is > to ever happen. > There is a chance that asynchrony could give the language a push > toward greater memory safety and make it more functional in style. > Because features in programming evolve according to the law of > accessibility. The more accessible a feature is, the more likely it is > to be used, and the more widespread it becomes. Go made parallel > programming more common because it made it simpler. >=20 > --- > Ed Maybe misunderstanding, I'm not proposing coroutines, I'm proposing to add = new functions for async io. e.g. // currently we have $content =3D \file_get_contents(); // old function remains: sync, returns s= tring|false // new function file_get_contents_async $promise =3D \file_get_contents_async(); // new function: async, returns a = promise object (similar to node.js using fs.readFile and fs.readFileSync) Regarding 10 year old projects: I would only add new functions and don't ch= ange existing functions for async io. So new async functions can be used, b= ut don't need to be used. I expect that's already a good improvement for many use cases to read multi= ple files in parallel, run multiple queries in parallel, etc. Best Regards Thomas