Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129391 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 293341A00BC for ; Sat, 22 Nov 2025 12:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763815052; bh=a408EE41IsmlkNM6jonc94a23ldYJgVHb7NFYasEvwU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=X403sV6yf1CbhL783ju7O/TlbogmAiCXHAlPC/F1LZZmgd/S2hdZ0a0uE5046/Kxx pwFEi21APtqrIxAebGW5qiNTv3R4/calIfIyvRzY2ECN8owWUZ39LlnELeqelvkkG4 7s2JVnx8IR7qn0m7s7OJyiUZxVNxuGJxnO7ItORVXvomaE4/9HKqyV2mc4FrhYoxyE s8VnNSnIACsfReMJiRUcXpwIpBMC8/aEhkiuQW2LncPycKgi/dlGyDf+3yRp85TEw+ lgYnIneiMs+yQu4mDDLj3tdBUtmcShBh2SWgOWiFbdRAeC12WtsHXyskdekXJydONJ 0unqJA6zEyy0w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0574D180082 for ; Sat, 22 Nov 2025 12:37:29 +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.2 required=5.0 tests=BAYES_40,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,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180]) (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 ; Sat, 22 Nov 2025 12:37:28 +0000 (UTC) Received: by mail-vk1-f180.google.com with SMTP id 71dfb90a1353d-55999cc2a87so388341e0c.0 for ; Sat, 22 Nov 2025 04:37:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763815043; x=1764419843; 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=a408EE41IsmlkNM6jonc94a23ldYJgVHb7NFYasEvwU=; b=C5aRkOMUotP3iyj3c+rIsu0SxIU4uB0ULJeqLqkrKAJaX97Jton6kHtKyo+dbRpGaI 3/BR8Egg8linYzWcNVkZt1zd6IqIJLbV341rqIbu3MR4NTIVqv0x3Ui7M+/FZ3PKJ/+9 pnT47GB1adtirHaJeuxCAfpnahbBpu2Q1/lGhtBoqRpPYqYGkdaHP/i6li9atix95zyF nAr2iCukou5ObmQiENsdBXpzp0r/ITKDUsSv1ZrKl1eJjk2to2MJj6ryb77hnMJMdVd9 1q60r3q6OboDSfnSGuK9mUJBuf+HOZBFcEOy1rSzmEogm3g6qhD09psBpq9xOW0hdd4p FTGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763815043; x=1764419843; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=a408EE41IsmlkNM6jonc94a23ldYJgVHb7NFYasEvwU=; b=WC2jJmIRjfoa7mqb1uT3+tuXf3AhHoV+EATmtdC0wOUW7FbC7JrXXm/j5Tx2cXTSZW eeFpF2ZT4lATbMISRlj5a7XjAPd3fkc1+HRo1Fb/TciGOiRUaz7KOT7RNHrni2j0y2XG TwnEOItdqsaLjgB89/cXb+SlLQ8ypsqjp3ORhtDcXF75tZpjhBx+NM7rJ4g4CM6uEG/j Ouedz2AjnTGfbJapS0q8G/CrbDoEMfFsjq8zEvGA92ks48lPSJiP+M7WL3JsvTKHlIRq GJUnlP9xRYMIsHiv6VorzMsFhXn0vFJM4japAbO2jz72j8R7la1D6AtkgNVPtu5daA82 V+WQ== X-Gm-Message-State: AOJu0Yz1B7d7Xb9iukRiqOM2aIPDshNpXQ5GK49kKqFcExy+Rf5nOi9U lV6f0TpUu61ef6Kb2utgxLNYArIMHp7xqeK0ffxiE43e4oZq1tclw8jNGi/8C2a7D+E7+J1NZLB +xaFTW0MYY+zzxuM94Hfcqw8TgkeQvcw= X-Gm-Gg: ASbGncstMno7j92xlVk9bFWZZ+47hwbkEnoxlilrglnor07YLc/x1pT6gg6oNdSvy28 HhIrVy5gM0viWJV5wL+xak3/uUeze8uBPmBQhZpxtKgRqdfbrHdMdHe/kTWz9aeAfwwMasXH5vb gyIV94DxSp2oOdXF80iq9+smctEZ6FzR4Zt2XYuQV28Ixzi1wii8d+bFtkr7GSNVygwU3a+nSuc 9iiDfkJw0WinXoFMersaz3dyAG3FvtDMcvFo6Ee464AKAdjy1kpTs8pyfHLuMl+UcvB39qkOLTK MFvz3u6p6RXBc5Ss5+5J926V X-Google-Smtp-Source: AGHT+IFJ0bF8NyzRaCsnTLis6VtGoDvTyG7P+lWpk+m8X3uJu2cvtunI4U6chcG9W0tjn183/DaJ8RGVjNb97yuQShs= X-Received: by 2002:a05:6102:4a90:b0:5df:c10a:6680 with SMTP id ada2fe7eead31-5e1de4386c7mr2188385137.33.1763815042967; Sat, 22 Nov 2025 04:37:22 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <383528143.397454.1763760932585@email.ionos.de> <691963327.399484.1763796022993@email.ionos.de> <1402906904.784903.1763811759896@email.ionos.de> <2015208655.784984.1763811978476@email.ionos.de> <980296152.1071.1763813573083@email.ionos.de> In-Reply-To: <980296152.1071.1763813573083@email.ionos.de> Date: Sat, 22 Nov 2025 14:37:11 +0200 X-Gm-Features: AWmQ_bm0_Y_dI3ebOAVjOU_3UIF_ALv4mfH3Ko3ia66MC_EkIJIN4kCjxamyfkk Message-ID: Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 To: Thomas Bley Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) > basically in $result =3D foo(spawn(bar(baz(file_get_contents())))); file_= get_contents() receives outside context from spawn() to turn into async mod= e. > Also foo(), bar(), baz() can be in different namespaces, different classe= s, so by looking at the code calling file_get_contents(), it's not clear if= the result is sync or async. Ok, then let=E2=80=99s look in detail at what is happening. > foo(spawn(bar(baz(file_get_contents())))) i.e. ```php $result =3D foo(spawn(bar(...), fn () =3D> baz(file_get_contents()))); ``` Did I understand the code correctly? (Assume there was also some parameter there, like a file name.) 1. We call `bar` in a separate coroutine, which 2. First calls `file_get_contents` 3. Then passes the result to the function `baz()` Is that correct? > Also foo(), bar(), baz() can be in different namespaces, different classe= s, so by looking at the code calling file_get_contents(), it's not clear if= the result is sync or async. If we are discussing the code above, then it returns a Promise not of the file-reading result. This is a completely different logic, and here the programmer clearly intended to do something else. What if the function baz replaces every a character with baz? It's ok. ```php $foo =3D file_get_contents('foo.txt'); // sync $result =3D spawn($foo); // error because $foo is string ``` Here I don=E2=80=99t understand why someone would intentionally write incor= rect code. Code: ```php $result =3D foo(file_get_contents('foo.txt')); // equivalent to // the code below has no practical purpose $result =3D foo(await(spawn(file_get_contents(...), 'foo.txt'))); ``` Is that correct?