Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114970 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86550 invoked from network); 19 Jun 2021 05:21:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jun 2021 05:21:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 189E01804C0 for ; Fri, 18 Jun 2021 22:39:22 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 ; Fri, 18 Jun 2021 22:39:21 -0700 (PDT) Received: by mail-vs1-f44.google.com with SMTP id b1so6136107vsh.7 for ; Fri, 18 Jun 2021 22:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=8p2+Ylld0za5wjeXbuPi9G+zJT9RDqyy6/u6hICqvkM=; b=A4FgqiG+MLjELmV1SrGVJUKiuT7RvACdJ7lL0+11TYMSALYwwPE+9xnhtieVw3Ae+g XZjB6yc8ZRj0GUfaiU1zi+fBN3yobDPn69pmRL00PYjBnhQY09PQqMCuWlqliTUvTUm2 /SFOAFf5+Kx6qup1Zn9SA5wvkRXSCjy9Gx+WyLSVYlYAUQmBB1sQiD9wwczU16XvLKU5 C7lNAQx27FxC+ZllBmXq1LfxvUTDI3ezcFypD5BYh2Z5gMDCsmAxRsVmMo1JfKU4ghdR K/W4WPbmNxoQIX4qO975SC+727jmhxUpXtkrxuTXVtU48HzHfNn+goLFcVzLNBMOCZDr 1HTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=8p2+Ylld0za5wjeXbuPi9G+zJT9RDqyy6/u6hICqvkM=; b=RRmZ6Nd8k2zWGfV4GCMSt0UiZ/HnB2T8pWJ36gEfF8V9DSpo4k5H1Dpa1GXWLGt3Wf Gy97+H502Bk7iPnbM4Zm0+SVBNL/CcJ0hWMOK0D89YV4kYDu86DdfOGbE4z69LMJb4xd FS/zw8iBP6InaDBT4hVkPYSam3/utk36ODMT4nk1wrVe3plqglcd8JPjZ41sqjA03gN1 md1HoabyRBF364WOBuvlvPy9kldUWrHiu+2eF7voKY9k+5l6PJSRoFNhmL4Dr/T9nJ9c cPwLVezku+7qIKT/tqMqsJui4XZeUZkSAQ+qQP7dY3MYUcxNAU62ENz/+e3oAApViSVR MNDQ== X-Gm-Message-State: AOAM533dhEtheL1luUynSjOOnTNLu673gPFNU4qTUGrNj1siRdO1oCHc 4DwM9ytdoETbM/wJ/vV1vuxp9tN/xa+rdt+r5L/TpbeHekw= X-Google-Smtp-Source: ABdhPJxFqhngWkqGAkjmw6wKK1QEuCv/MBSZW16anxJiIu9ICaOSVpCK+nmhXWiDauUKpLV+VXVrd3ZEtrbo8SaEBsY= X-Received: by 2002:a67:edd7:: with SMTP id e23mr10037437vsp.14.1624081159926; Fri, 18 Jun 2021 22:39:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:3730:0:0:0:0:0 with HTTP; Fri, 18 Jun 2021 22:39:19 -0700 (PDT) In-Reply-To: References: <222b3921-3d9b-47f9-8d13-e6a123f36fad@www.fastmail.com> Date: Sat, 19 Jun 2021 10:39:19 +0500 Message-ID: To: Patrick ALLAERT Cc: Benjamin Eberlei , Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [Vote] Partial Function Application From: office.hamzaahmad@gmail.com (Hamza Ahmad) HI Larry Garfield, Do you have a plan to further extend this rfc? I mean, what if one could typecast place holders? Broadly speaking, what if one could perform some operations, such as arithmetic, bitwise, and type cast as said above? `$foo =3D bar((type) ?);` `$foo =3D bar(? & 0xFF);` Best Hamza Ahmad On 6/19/21, Patrick ALLAERT wrote: > Le sam. 19 juin 2021 =C3=A0 01:41, Benjamin Eberlei = a > =C3=A9crit : > >> On Wed, Jun 16, 2021 at 6:17 PM Larry Garfield >> wrote: >> >> > Hi folks. The vote for the Partial Function Application RFC is now >> > open, >> > and will run until 30 June. >> > >> > https://wiki.php.net/rfc/partial_function_application >> > >> > Of particular note, a few people had asked about using ...? instead of >> ... >> > for the variadic placeholder. In the end we decided not to explore >> > that, >> > as Nikita explained off-list it was actually more confusing, not less, >> > as >> > it would suggest "placeholder for a variadic" rather than "a >> > placeholder >> > that is variadic." Otherwise, it's just more typing. The syntax >> > choices >> > section of the RFC has been updated accordingly. >> > >> >> I wanted to explain my no vote on this one. >> >> The examples section shows how every use-case of partials can be done >> using >> short functions and while this is often a lot more to type (especially i= f >> you mirror the typehints), these extra symbols feel necessary from my PO= V >> to make the code clear that creates a partial. >> >> Especially the ... as "additional" arguments and its various interaction= s >> with ? produce so many different ways of calling something, it feels >> unnecessary to me to introduce this complexity to newbies that might com= e >> across use of this functionality. Plus the additional edge cases of >> delayed >> execution, non-support for named parameters. Its a lot to know to fully >> understand this feature. >> >> Given that the functional paradigm isn't widely spread in use across PHP >> developers, i am not convinced that we should add more features in this >> direction that increase the complexity of understanding the language by >> that much. While one could argue that functional paradigm isn't >> wide-spread, because these features are missing, it is my believe that >> the >> majority of PHP developers would still rather prefer imperative coding. >> >> As a thought experiment I tried to think of code in our codebase that we >> could convert to PFA once we migrated to 8.1 and there just isn't that >> much. This is very different to short functions, nullabilty operator and >> other "glue" / sugar proposals that were added to the language lately, >> which a lot of existing code benefits from and existing code could be >> converted automatically to them using phpcs/phpcbf rules. >> >> I also am wary of the future after this RFC, as it states it is the >> launching pad to another attempt at the Pipe Operator, which also >> proposes >> to do a thing (calling functions) in a completly new way that will be >> hard >> for beginners. I hope we don't add both these features to keep the >> language >> smaller in this aspect of how functions are called. >> > > I second Benjamin's opinion, hence my choice of voting "no" as well. > > Every new feature we add adds an extra layer of complexity in an > exponential way, next new features/syntax have to deal with existing ones= . > The problem being solved with PFA, including how frequent it could be > useful in PHP's ecosystem, does not, IMHO, counterbalance with the > increased code complexity. > > -Patrick >