Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114917 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17722 invoked from network); 17 Jun 2021 07:37:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2021 07:37:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 95CFB1804A8 for ; Thu, 17 Jun 2021 00:54:30 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from smtp-in.fusiondirectory.org (smtp-in.geekview.be [195.154.20.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 17 Jun 2021 00:54:29 -0700 (PDT) Received: from smtp-in.fusiondirectory.org (localhost.localdomain [127.0.0.1]) by smtp-in.fusiondirectory.org (Proxmox) with ESMTP id 344AD101482 for ; Thu, 17 Jun 2021 09:54:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= fusiondirectory.org; h=cc:content-transfer-encoding:content-type :content-type:date:from:from:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fusiondirectory; bh=KnKUx1QN89WddiKCibGsBPP+WslZsesrKIfgBAqW8p4=; b=SXMmdAnTvbgA 2g6pr85TkKvd3TLXPPQWAxvXaM6xMEg/y1KMXtinXFcGiA70ZVY45lyWZiFpY7pw hCyRpBdWUV1Ozai94JywoeXT6sJ9gMomyFv/fz7bx0LSot5Op435MdMyfG+LPYAm 6bfeGiR13o9qWjg7QDtSse93wfKsmHeF4a30aoNirJseEAyNZNF2a3G+yaWKwQPJ H5sCDHDhXUuGL/HDAr6KqMBwzPe6k2YLHsQ8d1s4UaijKi0yhe2X5TSfczYPdhDw bofrOGkGuk4MbMUm0UHR86+Q3bvh8UGobuf9wi0VJ6ghtdcMdz1jqltyNgeIh2QH KySNKUkJDw== Received: from smtp.fusiondirectory.org (smtp.geekview.be [195.154.20.141]) by smtp-in.fusiondirectory.org (Proxmox) with ESMTP id 09F5E1013B2 for ; Thu, 17 Jun 2021 09:54:28 +0200 (CEST) Received: from mcmic-probook.opensides.be (63.120.199.77.rev.sfr.net [77.199.120.63]) by smtp.fusiondirectory.org (Postfix) with ESMTPSA id E05AD25CB72 for ; Thu, 17 Jun 2021 09:54:27 +0200 (CEST) Date: Thu, 17 Jun 2021 09:54:26 +0200 To: internals@lists.php.net Message-ID: <20210617095426.7e86bc79@mcmic-probook.opensides.be> In-Reply-To: <222b3921-3d9b-47f9-8d13-e6a123f36fad@www.fastmail.com> References: <222b3921-3d9b-47f9-8d13-e6a123f36fad@www.fastmail.com> Organization: FusionDirectory X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [Vote] Partial Function Application From: come.chilliet@fusiondirectory.org (=?UTF-8?B?Q8O0bWU=?= Chilliet) Le Wed, 16 Jun 2021 11:16:28 -0500, "Larry Garfield" a =C3=A9crit : > Hi folks. The vote for the Partial Function Application RFC is now open,= and > will run until 30 June. >=20 > https://wiki.php.net/rfc/partial_function_application I do not understand how this ... placeholder works, it feels inconsistent. =46rom the examples: > $c =3D stuff(...); > $c =3D fn(int $i, string $s, float $f, Point $p, int $m =3D 0) > =3D> stuff($i, $s, $f, $p, $m); > $c =3D stuff(1, 'hi', 3.4, $point, 5, ...); > $c =3D fn(...$args) =3D> stuff(1, 'hi', 3.4, $point, 5, ...$args); Why is there an additional variadic parameter in this one? If I remove the 5: > $c =3D stuff(1, 'hi', 3.4, $point, ...); I get this right?: > $c =3D fn(int $m =3D 0) =3D> stuff(1, 'hi', 3.4, $point, $m); Why the ... does not produce 0 parameters when there are none left? Also, in the second set of examples: > function things(int $i, float $f, Point ...$points) { ... } =20 > // Ex 13 > $c =3D things(...); > $c =3D fn(int $i, float $f, ...$args) =3D> things(...[$i, $f, ...$args]); =20 > // Ex 14 > $c =3D things(1, 3.14, ...); > $c =3D fn(...$args) =3D> things(...[1, 3.14, ...$args]); What happens to the typing of the variadic parameter here? Why is it remove= d? It would feel natural that the ... means "copy the rest of the parameters f= rom signature". Here it seems it sometimes mean that, and sometimes mean "acce= pt an additional variadic parameter and pass it along". C=C3=B4me