Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119721 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79991 invoked from network); 16 Mar 2023 10:45:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Mar 2023 10:45:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 684CD180381 for ; Thu, 16 Mar 2023 03:45:08 -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, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 16 Mar 2023 03:45:08 -0700 (PDT) Received: by mail-yb1-f178.google.com with SMTP id z83so1291766ybb.2 for ; Thu, 16 Mar 2023 03:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678963507; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=r8bGIEHw4236jy7ko/GtE98RSsAZImrwAt6FgJIEW5o=; b=AKnX3Y+jHf7fe2YSfh9Lvn+oxeXJTBOSMehnz3e0OzXKN6gaSp6EPbS4LHzIO3NSsz Xr6m6ECHHDP2vLo0M8Fpojyv2Cf0HgEgF6oAnuVi4Z4aXuL+/POOKO+Buyzhr2Can2J/ RRZftqE0KswonB3Nx+nmvMy+9wne9v6os6uI++A038gBEjZJ8Z+p5XkZx6nvx/mOaK+R 5oIIS+FnG4tHPxj2IFbuG5k7nc/vDwzDIxs7b0rMRx0D1wEv48ei1bWPtsGQ8AVYPpDY IZQcfPNa94dscqmgv9zSk25IEQAV5Y/zDhfn8sGoZdxGoaqfcbHKv8a3ZBWbeAYqc1sJ ENTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678963507; h=content-transfer-encoding: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=r8bGIEHw4236jy7ko/GtE98RSsAZImrwAt6FgJIEW5o=; b=3MdfbkbYnOP3E9Pv5a8P6VQHt2VxZIlWtZtRQaVp+5jKXcbtxkzScydPz+z+0T9fDn RS3Jb2siKjPzKzdTFiZca3atpaLxXBBfNl5L3nTU3SB388rLAcJtCM5uT3jtzZLkYOzk tABvM17RdqWJjWsYAIyHQEfoGqrQo2ITlqY2hgGGdB5RC8baWdIe9oukqlHVxA/yjRij eF6VDmh+jUnm0xSh6r8Dc71ZcyDiXgLChxoS5n+rUdxTnJD93uAM+IUGR/ijmI7Awoex ezLf5wXGFoUr+oonGa4c7B7htn7tuc++YqPlrNVOh04Vx6ZGOTAlOZ/TMAyXFiySNiaZ hB+w== X-Gm-Message-State: AO0yUKVpALVLUWc7XIveVRpXVjFld4rWoaZoWi2tzDF2R0GNLrt96yKZ +X8gsEgGT5oA5gCl6XD66t5BldGxhB0jZJoE+h0= X-Google-Smtp-Source: AK7set/PxvjXyxtcvJxLWehrWu6kwOXhXrmYzSBOaB7IuCslRyo9onMgJNWArfwaY60APkWf8q6GU9Gi7TwpB6IDe8I= X-Received: by 2002:a25:f50a:0:b0:b46:4a5e:3651 with SMTP id a10-20020a25f50a000000b00b464a5e3651mr5474646ybe.9.1678963507157; Thu, 16 Mar 2023 03:45:07 -0700 (PDT) MIME-Version: 1.0 References: <9975B833-EE24-4ED7-B28E-841B92988BA0@cschneid.com> <1A2CE63B-ECCA-403D-83AC-B1E26279323C@gmail.com> <9a2140b4-97bb-4a9c-90c5-809274c83f75@app.fastmail.com> <88c4a63c-859b-94d5-e314-3399fb2c3fb0@gmail.com> <1a4d4434-7318-4831-9fc0-8b48a6400a62@app.fastmail.com> In-Reply-To: Date: Thu, 16 Mar 2023 11:44:56 +0100 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] First-class callable partial application From: landers.robert@gmail.com (Robert Landers) On Thu, Mar 16, 2023 at 10:14=E2=80=AFAM Rowan Tommins wrote: > > On 15/03/2023 21:12, Dan Ackroyd wrote: > > Would it be desirable to split those two things into two separate > > RFCs, by having the first RFC not have native syntax support, but > > instead another static method on Closure? e.g. something like: > > > > Closure::partial($callable, array $position_params, array > > $named_params): Closure {} > > > Hm... now we have the first-class callable syntax, making it an instance > method on Closure would allow this: > > $mapFoo =3D array_map(...)->partial([$foo]); > $filterFoo =3D array_filter(...)->partial([1 =3D> $foo]); > > Which could copy over the full signature, so be equivalent to this: > > $mapFoo =3D static fn(array ...$arrays): array =3D> array_map($foo, ...$a= rrays); > $filterFoo =3D static fn(array $array, int $mode =3D 0): array =3D> > array_filter($array, $foo, $mode); > > While being a similar length to a much less rich version: > > $mapFoo =3D fn($array) =3D> array_map($foo, $array); > $filterFoo =3D fn($array) =3D> array_filter($array, $foo); > > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > Rowan, that is actually fairly beautiful. May not even need the second RFC...