Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116644 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78359 invoked from network); 14 Dec 2021 17:32:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Dec 2021 17:32:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2E4C11804D4 for ; Tue, 14 Dec 2021 10:34:41 -0800 (PST) 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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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 ; Tue, 14 Dec 2021 10:34:40 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 24E203200F81 for ; Tue, 14 Dec 2021 13:34:39 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute6.internal (MEProxy); Tue, 14 Dec 2021 13:34:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=H9FNNxebSe/JZv6N/JcRFkpFguvZGUcPasrukIWAt 0I=; b=R1ny4m/afAVx/SqPm6pER2OPae6TeQ/6MKtkWGx98FQRseEHH+3yruofI ioEnEFrL/+qeXhS4R6jzZ+tZhCdtSG80WX5QJ+XUoUh1WkzpYi6PAKYF/L7uqSsy wa+BdhqiLYs1GEnhzPy8Cf1BncmrXh2/dpO7GGXI4St+pwR8RENXS+HobD9VC1WD fHSBmHHOD9+0IiAFDneIpVkYvzOYZu66sfVNAJvvRMmQYXcWi/+KZqNd64gDzylP ol9B44VGhT4OAMT5Ni/n5wzXLGQv2puv/WO3ap34ABXz33Lt5wjJvCtJzgdlIub+ CazibQSLg975eEdzaLTJ4CxRAhVDw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrledtgdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepffffffejffdugfegvedviedttedvgfejffefffej leefjeetveehgefhhfdvgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4D6F4AC03DB; Tue, 14 Dec 2021 13:34:38 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4514-g2bdc19e04f-fm-20211209.002-g2bdc19e0 Mime-Version: 1.0 Message-ID: In-Reply-To: <1639437120.436292407@f322.i.mail.ru> References: <02ba01d7ecbc$c0e13370$42a39a50$@webkr.de> <1639437120.436292407@f322.i.mail.ru> Date: Tue, 14 Dec 2021 12:34:17 -0600 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Allow default parameters before non-default ones? From: larry@garfieldtech.com ("Larry Garfield") On Mon, Dec 13, 2021, at 5:12 PM, Kirill Nesmeyanov wrote: > I'll add that leading optional parameters are needed to implement=20 > currying and partial application. > > ``` > function foo(int $opt =3D 42, int $req) {} > > $foo =3D curry(foo(...), 23); > > // $foo =3D fn($opt =3D 42, $req =3D 23); > ``` > > While this is not a popular practice in PHP, this deprecation=20 > notification =C2=ABbreaks=C2=BB all code that uses functional pradigm/= concepts. >=C2=A0 > -- > Kirill Nesmeyanov This is simply untrue, and I have not seen any code that does currying i= n that fashion. If anything, trailing optional arguments are what make = currying difficult as it's unclear when to "stop" and invoke the underly= ing function. (The previous PFA RFC had that solved.) I do not like the original proposal here either, though. If we decide w= e want to allow an argument to require that it be called named, that sho= uld have an explicit keyword to indicate such. It should not be an impl= icit trick of otherwise confusing argument ordering. --Larry Garfield