Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129436 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 6FB0F1A00BC for ; Mon, 24 Nov 2025 16:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764000402; bh=2de4IbHLRpQPhX9ztuxDiuMEmmGp5m1xEk368GySUCg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RqWslGj5jGhNv+LShm0B4DMrBlOIhCu2EdYnFWxJgVKDqsGpgTeSLYCGqM922plB2 uNqGFkEJhWl0Ji3yY/mKb0qgDVZEjiHV+O/3N58rA+X9X81XpB37q3q/nUHmw/iwtr sW6eH0C4axXDlXxkM5KWYMuRCE8Wvj8HtJ7LrS6ioy5tkZjccp798VVTVJPo/aOiPM NjgF1DYVhvKN2NBL39bs48+H9aCt5NSOFOiivw6er93aaelbnHRpiayiHi0Ez8e6Hw X6EvnQZpbEwokoBCr1f7wsk+LVgYlUKDkjU3ibTrGYra5hrKaslkGDuEuiRjan7PYs bxpWSkYwvv6cQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5AA001801EF for ; Mon, 24 Nov 2025 16:06:41 +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-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) (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 ; Mon, 24 Nov 2025 16:06:41 +0000 (UTC) Received: by mail-vk1-f174.google.com with SMTP id 71dfb90a1353d-5597330a34fso2954086e0c.2 for ; Mon, 24 Nov 2025 08:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764000395; x=1764605195; 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=Lue7h2MDbyBuL4eO87kZtyO4FJ7bHyLkZBuCkeAw3Iw=; b=RiT8EJDTSWw4oMktGf1NINg7etDmclv4+WkD6EQmIpFCrHrZxleDficwJaI36nkV7A ENlL0z3+4ZrX2ee3GX0a6OYvRxHLsZ1RoKfD0bMovDD+2ukZIK2bddQDMKrJwJCIbNUp y5r3U+BCw28QypI2uX3GMTInHkh75IQksVt172i9MJQ3JToILqwfmJanI0EP5dSWdQyL HY/DtsqDE8BJxV4U+C37MAETm+UYVACsgfuxvIgIL3aNtUolTJHmjywrqEbb+HJE6mdZ zPRmZZZAOiOV6xkOuK6x/IoE9rxqSZOnx50riqanuk43C5+WQgODgvFmo9fK/YR0ElXG 5yEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764000395; x=1764605195; 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=Lue7h2MDbyBuL4eO87kZtyO4FJ7bHyLkZBuCkeAw3Iw=; b=Y1exkGfClR9mTYkpHWAmHNdIVAq2PLiGR8TfZiYn6N1cfFEsDMkz72v7Yacp/tbHmv KSPG3I51S9Ilr/ZLoxsKOgi/HhNLcctc/CqtN2K5lu71iRwRaLLtHVKn4Mboi387Vi2k DlvTvAsGriQ5NiCHNhL2oV7iq2GxI5ohknnO+czUes5x2TIcZGVdSkzj3oHQsQzOhBkQ KBlDCXlRjgAVO2hnlZhr+V3xc1FPsDHCIFn7bMHXm6bltqHat0cce1eSPkWA3vxELJ4Z LJKa09l6SypZFZcJgK5zpAJfeLQbg2bUVZiU7l3PQ30kEb895k86anFX5MVhzP018LKw 1UVQ== X-Gm-Message-State: AOJu0YyoACS+BfhQj+Xt0qUdmR5kccU5q9t7aSU4ZhanO2x1c4Z8mwEu R8Dav3AoD1zny9gOGYiZ+b+fF2cwlsupnMB89etGXr0ePd/tXZxPDi9bSy9ZfhI770767b2InNK +BUUhzgBu9INgGwpsqYfdBJfYpiDVoe07O5A8 X-Gm-Gg: ASbGncu0B/VDMVfFo4qdHSajrN5bHa9IuzCykloRSmStUJ1hbEQseGU/LFa6yKR09Bl qr8xB3LFJRZBROe04+iKK1tX5gYKffTmCsioJjHFKfXYwBgRUw/4eglHJbVh5tu7e2MWi921NBb jKMkDRtqWXYcZ9504mAAH87EY1CKHqbrz81y8H+Wyc5XrrW7UjNlaClHxRYPMBaQnlsUrxTs1bw neSmpjj9Ew0WXZqnJZKNDfqYqECMBp8SyPDOe9D3l/y0Tz4qLX8MkI/hqb+30G2a3k5p/jL5rg0 DPAiTnPXLVsMru5N+xrZgVNYaVM= X-Google-Smtp-Source: AGHT+IF1C/U6VqFB7ddsrYLsCMKWB6FBnt7Gf31wWnufBxDYGtEhyUjjLw88wEeJwSfjdQ+B//6fh5BJcZknZYFcZpk= X-Received: by 2002:a05:6122:178f:b0:55b:305b:4e42 with SMTP id 71dfb90a1353d-55b8d80d2b4mr4027637e0c.19.1764000395235; Mon, 24 Nov 2025 08:06:35 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <2015208655.784984.1763811978476@email.ionos.de> <980296152.1071.1763813573083@email.ionos.de> <92865666.4510.1763818506332@email.ionos.de> <329450798.8037.1763822426377@email.ionos.de> <9287c46c-bc63-4dd0-9792-0f9421959589@rwec.co.uk> <65869feb-d518-4de3-8c10-115e3ba7dce7@rwec.co.uk> In-Reply-To: <65869feb-d518-4de3-8c10-115e3ba7dce7@rwec.co.uk> Date: Mon, 24 Nov 2025 18:06:22 +0200 X-Gm-Features: AWmQ_blFZjDS1c527LC8EaX2UK2-v8hG8nPu5UsgO52ty5Ab6y3GWFB5duEzhwM Message-ID: Subject: Re: [PHP-DEV] [VOTE] True Async RFC 1.6 To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Yes, let=E2=80=99s consider scenarios for all three possible memory models: 1. Coroutines share the same global and static variables. 2. Coroutines have separate global and static variables, but the programmer can explicitly pass the same object. 3. Coroutines have separate variables, and the programmer cannot pass regular objects as shared at all. Let=E2=80=99s say SDK Susie publishes her library, which depends on LoggerI= nterface. Let LoggerInterface internally just use plain fwrite calls and a shared message array. But Susie=E2=80=99s SDK doesn=E2=80=99t know that. ```php function flush(): void { file_put_contents(implode("\n", $this->logs), FILE_APPEND); $this->logs =3D []; // clean after save error } ``` Such code, when called from two different coroutines, may write the same data to the log file twice. Then, if SDK Susie=E2=80=99s code creates a coroutine and uses LoggerInterf= ace inside it=E2=80=A6 1. =E2=80=A6an error will occur. 2. =E2=80=A6an error will occur. 3. PHP will not allow the same LoggerInterface object to be used in different coroutines without changes to the code. > - Legacy Les is using a LoggerInterface implementation written years > ago. How does he know whether it is acceptable for use with Susie's libra= ry? For the third memory model, the entire burden of guarantees falls on SDK Susie, who must think through exactly how to use LoggerInterface. If SDK Susie has no ability to modify the LoggerInterface, then she is required to use it outside of coroutines. For the first and second memory models, the responsibility for correct behavior lies with SDK Susie, but the difference from the third model is that SDK Susie can simply forget about it. --- Ed