Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114486 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75161 invoked from network); 15 May 2021 08:12:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 May 2021 08:12:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5ABA81804C8 for ; Sat, 15 May 2021 01:20:54 -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-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 ; Sat, 15 May 2021 01:20:53 -0700 (PDT) Received: by mail-wr1-f42.google.com with SMTP id m9so1380198wrx.3 for ; Sat, 15 May 2021 01:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=V2mA1BuQ724QHkUxKJvppUSaoXWUPmB9k9uhbuh0vU0=; b=BYg+wPvp+eH0mMXR9J5DPP8+BKlmDw6CVK/fx/uQf7+qMcz8ZIh/pdZihokuEUtsRX aWazRKkVvKQLl2Cpt1Jl4LVFcB5CSmnQ9bXUS669goUhidJzwxgd5YKNcDwN9pBkIC0H UxOI1Qs8fCTySbyiLEVmHmUBulw3SmMbQfGTnFK7P4oSLMN98NqjFq4R5r5NTFd/3phF OmQBP/W55Zis+H1VqdzQR0EnaD1kZ3wOAMvzl6YJKldVdFfwKSiY/1V+CosJbZnPlzbv dLLTge++jc95hm6Vr/VHDxAINSeB7bMAt1b0e+I+m/jZ3Wl9i/h3+t21BOWosTTG+Jxf I/pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=V2mA1BuQ724QHkUxKJvppUSaoXWUPmB9k9uhbuh0vU0=; b=TFwdeakXfs0cfzYchHbm09QMnnRKXMvLLCBYZqRCeMOvS7Qk/DAPnIbJqFmQj5bWEY VqkLCiXmCkvuueiK6myVN/ngO716jb8TxS1uhKVYTaBAlMJNnCk0Wa4QNZ7EaSMhMg8s BGT8KBN+riq6jTxh9s2njL/dG52R2U+EK6cOdGmAXPgbwWw4wlSrogCkFbSjddhw3QKz ZDxCn3Pbim5N95VKlymexzbSD0V6Q5mnLWA2g1WutfH2nKcIojIk40I67GRic7Ym47Al d9lGzImoAGC5bZO85mAqZlw65dFSL6RE6U9t9/3+yLZ7DL8sIhrb6yZbPeMA6l0uhNvs zkHg== X-Gm-Message-State: AOAM532aOKlJnwgwbUpJFJwmwiCOIKX6SoL3VhTLvNjnt6gFJ89Y1VPq mzgnEbYOxz4q36zOyEoUwxPofcDQ3qc= X-Google-Smtp-Source: ABdhPJy+gM51VWSu/J9U+a/7r9QlxwzcTytGwfnacc74to27dgB/CY83CGeQ7dpAsg+dai74JLVpRw== X-Received: by 2002:adf:d1c4:: with SMTP id b4mr63735585wrd.301.1621066852593; Sat, 15 May 2021 01:20:52 -0700 (PDT) Received: from [192.168.0.27] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.gmail.com with ESMTPSA id c8sm13329304wmr.48.2021.05.15.01.20.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 May 2021 01:20:51 -0700 (PDT) Date: Sat, 15 May 2021 09:20:48 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: <1565EB81-57B7-49B0-A47C-342E0088A432@trowski.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net Message-ID: <912F2203-FCEF-441E-9272-65624F4C0FDB@gmail.com> Subject: Re: [PHP-DEV] [RFC] Partial function application From: rowan.collins@gmail.com (Rowan Tommins) On 15 May 2021 00:09:41 BST, Paul Crovella wr= ote: >I think this highlights where the misunderstanding of this feature is=2E I think the fact that there is so much confusion highlights why it is wort= h considering different designs=2E >Partial application is about binding arguments=2E ? isn't an argument, >it's an argument placeholder=2E It does two things: signals to create a >closure wrapping the function rather than calling it immediately, and >holds a position in the argument list so that an argument further to >the right can be fixed (bound) at that time=2E This is not a correct description of the current syntax=2E Currently, "?" = represents a *required* argument in the argument list, but *only* if there = is a fixed value to its right=2E If it appears at the end of the argument l= ist, or with only other ? tokens to its right, it *only* signals that a par= tial should be created, and doesn't create a required argument, even though= it looks the same=2E foo(?, 42) creates a closure with one required argument; foo(42, ?) create= s a closure with no required arguments >Requiring additional trailing argument placeholders or adding an >additional token `=2E=2E=2E?` unnecessarily complicates things, burdens t= he >user, and only serves to further promote misunderstanding=2E On the contrary, saying that "?" always means exactly one argument massive= ly simplifies the description of the feature=2E Why persist with a version = of the syntax that is so easy to misunderstand when we have a really simple= fix available? I acknowledge the need for a syntax to say "accept zero or more further ar= guments", but this doesn't need to overload the syntax for "create a requir= ed argument here"=2E If the suggestion of =2E=2E=2E? is too long, we could look at other option= s like =2E=2E=2E or ?? The syntax for "just make a closure and pass all arg= uments through" would then be "foo(=2E=2E=2E)" or "foo(??)"=2E There is a *separate* question of whether arguments that weren't *required= * are passed along anyway=2E I'm less sure there's a right answer there, an= d would be happy with a version where foo(?, 42) and foo(?, 42, =2E=2E=2E) = were equivalent - that is, the trailing "all other arguments" token would o= nly be needed if there wasn't already a placeholder=2E Regards, --=20 Rowan Tommins [IMSoP]