Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126887 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 qa.php.net (Postfix) with ESMTPS id C231D1A00BC for ; Fri, 21 Mar 2025 10:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742554090; bh=P3rG4b3rMQdddC/fC5QT2kpqlKM7HmizMTCjBPfDt2I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=f8XEDpoOPYYU1ULviJ8QTIryYw2illWNF1FyQmIr/i7pK81TpSMSEXmt/uYA+kzns v+peDrtAi5Oi3hbLqJV7Mvp1brKUTQ/517aJYZdxEULZNqIvX032VkjW9MELQMJs7R zraglna3us7ZBuY4l6O7MCnvGKWqSHMFAl6z78jhfYWhFN6kJ8G51LsnvMfLOcFAmh FiobdrOjYLyb+6r0kIcONf/vKvEBtgqn+3h6cjPqFmvhL8rcplc4+GJIPc3o4/0D35 Zg/1E5JWLwu6pkffGDg1N6m5K6bXmOjCjlxkVEclAHO0dar/94+rz5sBGUDKbxCSQT OZKrLBH4C9Qog== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1FDB418056F for ; Fri, 21 Mar 2025 10:48:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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 ; Fri, 21 Mar 2025 10:48:06 +0000 (UTC) Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e455bf1f4d3so1444724276.2 for ; Fri, 21 Mar 2025 03:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742554236; x=1743159036; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aFuoiaW8EYM0j74XFWWvKvdptZtPP0jna+ICSL20kFk=; b=TK1TVvFKi044XihoodEjT1HHNe2UoGRgRFJkeNsxRioKBTUftFVJVD7J7tV4gvC/yJ YDXi5KYtIS7R+b/g+kL0uEAHctSpZz9NxM63QB8waPG/INTarE/kibwf7euaaOxIMG6M bmhpYXy1Hke+hMNdtuzu5h7EtGBcBqDQhmrs1SQ1LHIRBp31ne7IIXPELj9MVe55YMJ+ 9laaU5BHfYcHw7tfPn/2iNVp+hqaEN0vyYEU0MOQfNk2d3WxIaqSRRxzWOqcW4kfP1aB 6mPrhM6yx1vNDGSz6xFaFtwvnNcQ1sCrlmnvrX/mcoJvjnOh7MLwF5+9yJUW55GjZbrG uFAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742554236; x=1743159036; h=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=aFuoiaW8EYM0j74XFWWvKvdptZtPP0jna+ICSL20kFk=; b=BXD9ZppdJ7Tn3ue+Q0PrYwsz6aFyTyzRqJAc1A/Tfnwj5bu3qAJAsLJBY9KvY+Okgr 4FILIbIlc8t1/0ZoCeWQh3y09mPD1hm26NmtGBpAy0BYXY5SyhOIVqGgWPomMvefjCI1 j3jD7bEtcC9p3Wpf+6Zn3ip1coGwrM991QfGE2hsFkktKXShgnOe7vJtwV2zSDXfBk8g BO5TL/TO/0EgfTogsAVqcxBKEoAOVUwXUnmYXuXhLy172455aAEj65dM3T4RFVQiq0eh 5xfxDFrpBqE3YbLxxoH1wfSv9agUQncT4XqGdqyBiMQ5hc9gMaOfe6ITJNiXWlF9Tc8y obow== X-Gm-Message-State: AOJu0YxApU12w1X8D0rYtgu5n8hOS96eSTPqWzSzO25CSMZ9qw4cO2pi bSSMFs14qLGii/t4Vgg8UPm7DSloAQpF2xrFQpcMOhryrC/pzBBSoy3MXFKG3brpTwhG79zoahG adKgqf10tj0SPkhPWj42Cg2UH+djID4C/WQ4= X-Gm-Gg: ASbGncs/uYglhug2m4QTRAy4xVb6OkFDXHXMFlIIdZrOlXMiBXAy3lebZRvHO/EgEKH qZOKhwt+E8+E+Qezgcb7BeldpO5jnNO09R3hbrgxx+M4uscuWhVtQ0mMqEQZk7/hCHdbRLSMPw7 /0jFISgQdyAc4D8HhlmqgPgszeMxLtfQm0nJok X-Google-Smtp-Source: AGHT+IEwx9gWergFmU+LqHqt0VpYr0GN6CYg2G71dhLpj3GiiZSwTj+XpjY0CAQbmsH2dFSzRMAAtb+cy3w9gYhYpPg= X-Received: by 2002:a05:6902:4890:b0:e5d:ad43:9b36 with SMTP id 3f1490d57ef6-e66a4db1362mr3455875276.20.1742554235873; Fri, 21 Mar 2025 03:50:35 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <6987D912-CE46-4145-A8CE-732CA590A522@rwec.co.uk> <2F013672-9937-4AB1-BC46-86F3D342BE6B@rwec.co.uk> <743c84d4-28db-4f68-80e5-3cad2dac6e68@rwec.co.uk> <4669e994-fe7f-4c3b-9920-ef6ac0118f1f@rwec.co.uk> In-Reply-To: <4669e994-fe7f-4c3b-9920-ef6ac0118f1f@rwec.co.uk> Date: Fri, 21 Mar 2025 12:50:26 +0200 X-Gm-Features: AQ5f1JrJK4aYVZ665_Akcw0Ne72Vo1-F00g7IkCe9G4QgXZ57-dAQGBGjDy7QiE Message-ID: Subject: Re: [PHP-DEV] PHP True Async RFC - Stage 2 To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000003b35660630d8066c" From: edmond.ht@gmail.com (Edmond Dantes) --0000000000003b35660630d8066c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > Again, that's the *how*, not the *why*. We only need to "get rid of" the parentheses if there's some reason to type them in the first place. > I=E2=80=99ve already understood that. You mean it=E2=80=99s not the reason,= but one of the possible solutions. But it=E2=80=99s one of the solutions that, from my point of view, causes l= ess surprise. Because the alternatives like `spawn fn` and `spawn {}` seem more radical to me compared to the current design. In that case, perhaps `spawn_fn` or `spawn closure` would be better options= . > > spawn ( fn() =3D> do_something( fetch_something($input) ) )(); Now this option, I=E2=80=99d say, looks realistic. > spawn =3D> do_something( fetch_something($input) ) ); Looks good. But then, of course, it turns out that spawn plays two roles = =E2=80=94 including defining a closure in the language. That specific point is what makes me doubt it. It's like the language has TWO keywords for creating a closure. Essentially, no matter how you approach it, some compromise will have to be made. * Either accept potential confusion between a variable and a `function`, * Or agree that a closure will have two forms, and everyone will have to learn them. If we go with the second option, then we can use both forms: ```php spawn use {}; spawn =3D> code; ``` > > Again, though, this could easily be added later when a need becomes > visible, as long as we don't do something weird now that closes the door > on it. > I tend to agree. If there's doubt, it's better to postpone it. > spawn =3D> $input |> fetch_something(...) |> do_something(...); It can be made even cleaner by adding a parallelism operator. That way, there=E2=80=99s no need to write `spawn` at all. > > I suggest we leave this sub-thread here; there's plenty of other things to discuss. :) > Ok! --0000000000003b35660630d8066c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>
>=C2=A0 Again, that's the *how*, not the *why*. We only need to "get rid o= f" the parentheses if there's some reason to type them in the firs= t place.
>
I=E2=80=99ve already understood that. You mean it=E2= =80=99s not the reason, but one of the possible solutions. =C2=A0
But it= =E2=80=99s one of the solutions that, from my point of view, causes less su= rprise. =C2=A0
Because the alternatives like `spawn fn` and `spawn {}` s= eem more radical to me compared to the current design. =C2=A0
In that ca= se, perhaps `spawn_fn` or `spawn closure` would be better options.

>
> spawn ( fn() =3D> do_something( fetch_= something($input) ) )();

Now this option, I=E2=80= =99d say, looks realistic.

> spawn =3D>= =C2=A0do_something( fetch_something($input) ) );

Looks good. = But then, of course, it turns out that spawn plays two roles = =E2=80=94 including defining a closure in the language. That specific point= is what makes me doubt it.=C2=A0=C2=A0
It's like the languag= e has TWO keywords for creating a closure.=C2=A0=C2=A0

=
Essentially, no matter how you approach it, some compromise will have = to be made. =C2=A0
* Either accept potential confusion between a variabl= e and a `function`, =C2=A0
* Or agree that a closure will have two forms= , and everyone will have to learn them.

If we go with the second opt= ion, then we can use both forms:

```php
spawn use {};
spawn = =3D> code;
```

>
>=C2=A0 Again, though, this could easily be added later when a need becomes
>= visible, as long as we don't do something weird now that closes the do= or
> on it.
>

I tend to agree. If ther= e's doubt, it's better to postpone it.

>= ;=C2=A0spawn =3D> = $input |> fetch_something(...) |> do_something(...);

It can be made even cleaner by adding a parallelism operator. = =C2=A0
That way, there=E2=80=99s no need to write `spawn` at all.

>
>=C2=A0 I suggest we leave this sub-thread here; there's plenty of other things=
to discuss. :)
>=C2=A0=C2=A0

Ok!
--0000000000003b35660630d8066c--