Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114466 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3011 invoked from network); 13 May 2021 19:23:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2021 19:23:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3DD781804B1 for ; Thu, 13 May 2021 12:31:31 -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=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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, 13 May 2021 12:31:30 -0700 (PDT) Received: by mail-pg1-f172.google.com with SMTP id m124so22347943pgm.13 for ; Thu, 13 May 2021 12:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xCOQ3wyzxe+NWGhjUx84uDDOlJ4HjKufCITU6ltX5YY=; b=newIqyEAJrQ4oFP/p3TOz/mDZWodYVObcvYeWEkgF0wGPBS3IgIMrt8/bGRrcAwFub REJmnitgnrL9ZXSgkXBzom4I1paOIM1hlb7BF8UFuVOYN+GwGHIBFTVsF0No92ajPkGA gmSsyWD78yunERTXCBSLvseMmepou2gClH/GgiwI4ajeqUHmB3QNzKWBhv9iyAVtdj2z 9j2w6x0z8kKnndmBAHX6CCWpHNW39CbB8N80h5ZD21koZFYzAAPwhX9uH3vhW3RANe2X ukcNIWByomqevKJqoFcOj7uzJX3V7Er7em9mtmqX4Zk6rtMZR83nq2+jTyjFiP9wUR6M Btsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xCOQ3wyzxe+NWGhjUx84uDDOlJ4HjKufCITU6ltX5YY=; b=A+wKCOcFZ1WKSrx2rTGOKVJSwXry9/RB3+OpeY8+WuP4bj0Uphc7Id1mwZEucSDGuP 6gaFoMsiH+jIHSEZvrAd0igRQEULBXoRQ14L2fm1uYFCDPTxw6pkeJqPWRTv+tzFxMLy f7UNADPUu+vnVhZhu+5h6z81o/vKJn1murGdqZevW7GLXK0nMJJbllvuqwk35YJURz0+ rJp9DZsvFZGzSNTiuQN6bD4Qs36VcTATGez5szuP3sJITltUpXzFAyXJFCeRAlPIBX1S erqrceloMQCFBRX+z+6PMLcsxMqvGIvNx6/KuDoRE1X7IPJ+q3srFYOKDcGpstkR2TJs r7Xw== X-Gm-Message-State: AOAM533yAEslLepVCX0EEYQ4Z1WXWyysPuhW0Am9pUJw44yEi5bs4L3O pZLMo8jEH3jEukuPZNhIG7O52NayjbVKsBTRrLjxixH4N0c= X-Google-Smtp-Source: ABdhPJw1IOQrPcm1d22jr3tpAzL+IOpfHOds7Dvcyd6tt6wKIuUfHRWPiPNQ94ROvo175Jw+vCkJw1ureQ0o3eVd6NQ= X-Received: by 2002:a63:ad0f:: with SMTP id g15mr14728816pgf.415.1620934286939; Thu, 13 May 2021 12:31:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 13 May 2021 21:31:16 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Partial function application From: andreas@dqxtech.net (Andreas Hennings) On Sun, 25 Apr 2021 at 21:27, Larry Garfield wrote= : > > Greetings, Internalians! > > I would like to offer for your consideration another RFC, specifically sy= ntax for partial function application. > > https://wiki.php.net/rfc/partial_function_application > > It includes an implementation by Joe Watkins that is already about 95% co= mplete. (There's some edge cases he's still sorting out, but all of the ty= pical cases should work already.) Most of the design work comes from Levi = Morrison and Paul Crovella. I helped out with the tests, a few edge bits, = and general instigator/nudge. :-) > > Discuss. This is super nice! I can imagine many ways I would use it. Some questions / thoughts. ---- 1. Serializing: Will the partial function be serializable? I assume if the original function is anonymous, then neither the original nor the partial will be serializable. Also if any of the fixed parameter values is not serializable, the partial function can't be either. But outside of the above cases it should be technically possible, or not? ---- 2. var_export() Calling var_export() on a partial function could produce the original code that generated the function. E.g. var_export(foo(?), TRUE) =3D=3D=3D 'foo(?)' ----- 3. Parameter switching Could we express the following as a partial function? static function ($a, $b) {return foo($b, $a);} E.g. as foo(?1, ?0) ? Perhaps it doesn't need to be part of this RFC, but it is something to cons= ider. ---- -- Andreas