Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119690 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84698 invoked from network); 14 Mar 2023 09:16:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Mar 2023 09:16:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9EC391804AC for ; Tue, 14 Mar 2023 02:16:29 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, 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-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 ; Tue, 14 Mar 2023 02:16:29 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id i9so4603217wrp.3 for ; Tue, 14 Mar 2023 02:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678785387; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=pMPBFW1xexY+3TIAXdRUisEe0r2HP8gw22I5pqtw97A=; b=VOGlig9Qi1chIWYT5i5G6aZj/+Ko1QYGejokBF5YGlvlae2nhj4ZGobqme0nUO+ZeV xBoKRRwTElxpRFhfBELRsBzKw/+fL1b+eu6osdsqL4h4MGq+2kAdvCJv/NtFvQ3AqMEj hezN1ab11CGX+ubNahZnmUZ0oZOFp4X5KeuDujNZdIxZdk349Uc921IbXg4qTLgt1wDQ YOk3LYWQ3F+MBqabuCQ9Pbvn7C+iemCApGr53DYOkpR6JXaWc2W8dj69RlKCyRUFdXav mj4PIBCV1g50X2ZLCb19rRYP5qBXYQ/QGj8EqOgVAWOflovbH4FgPIehtVxFUB5gI1Cx sWgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678785387; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pMPBFW1xexY+3TIAXdRUisEe0r2HP8gw22I5pqtw97A=; b=nvJdD14uy27TQjkSrssFu+QS3aC1KPOotqxIYUERXnGqVNA9T588ScobIZ+P9xTRNf rUtWDnoqNQAPPNPIfPzfLlzieM7/3f3YxYMH8U3NW/T4na3G8tniPmded/LYnCqOj/Bn E5ElvsxMitROc+SzfsIT1wvl+s9ViOu7eO59ft6twV1aG9SWIGbsI1EwV7TBF/UI81Tf ZjAJMizwMr3uS4J2lBCzWDus5sj97WeWhmIX43p1BAGlhvdTOI691zGR3nE9pWUDuwRc 8F2AIjXW6ZASbsZlq12mfegkv9sRShkMPJZx3b0qS1UHZjiocmLwE88lb7kn8Spd0LZM 5Wcg== X-Gm-Message-State: AO0yUKVrLsVse9UGtW+frdMgIvzaIt0UtYpzRom5x5SpHkdbAH9yp8Fe dMEr8PaubjgePia/tNFsCh7hay1FBBw= X-Google-Smtp-Source: AK7set/a3uWP6y+owvqz1OLE3eyO8B7q+jx+CtWm2v1/OSbcCLUx3ItxXm1cMsqKHCgAwnSY6Mj7TQ== X-Received: by 2002:a5d:6a88:0:b0:2c5:58f5:3c40 with SMTP id s8-20020a5d6a88000000b002c558f53c40mr25995540wru.47.1678785387609; Tue, 14 Mar 2023 02:16:27 -0700 (PDT) Received: from [192.168.0.22] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.googlemail.com with ESMTPSA id f7-20020a5d4dc7000000b002c3f81c51b6sm1503513wru.90.2023.03.14.02.16.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Mar 2023 02:16:27 -0700 (PDT) Message-ID: <88c4a63c-859b-94d5-e314-3399fb2c3fb0@gmail.com> Date: Tue, 14 Mar 2023 09:16:24 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: internals@lists.php.net References: <9975B833-EE24-4ED7-B28E-841B92988BA0@cschneid.com> <1A2CE63B-ECCA-403D-83AC-B1E26279323C@gmail.com> <9a2140b4-97bb-4a9c-90c5-809274c83f75@app.fastmail.com> Content-Language: en-GB In-Reply-To: <9a2140b4-97bb-4a9c-90c5-809274c83f75@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] First-class callable partial application From: rowan.collins@gmail.com (Rowan Tommins) On 13/03/2023 20:44, Larry Garfield wrote: > As has been discussed numerous times, all of the most used array functions need to be redesigned to work with iterables, and in many cases make more sense. That would be a natural time to also revisit parameter order to fit with whatever partial application syntax was in use. It's not just the array functions, though, it's every single function built into PHP, and an even longer list of userland library and framework functions; and there will always be competing reasons for preferring one signature over another. What attracts me about features like PFA is precisely that they let you work in new ways *without* having to rewrite all of that. Some more examples of placeholder-first application, from a quick skim through the documentation: $escape = htmlspecialchars(?, ENT_XML1); $containsAt = str_contains(?, '@'); $priceFormatter = number_format(?, 2, ',', '.'); $addSigToFile = file_put_contents(?, $signature, FILE_APPEND); $takeOwnership = chown(?, get_current_user()); $encode = json_encode(?, JSON_THROW_ON_ERROR | JSON_PRESERVE_ZERO_FRACTION); $unserialize = unserialize(?, ['allowed_classes' => false]); $isLogger = is_subclass_of(?, LoggerInterface::class, false); I'm sure I could look through Laravel's documentation, or Symfony's, and find examples there too. Regards, -- Rowan Tommins [IMSoP]