Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114519 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41916 invoked from network); 18 May 2021 21:18:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 May 2021 21:18:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 73EE31804C8 for ; Tue, 18 May 2021 14:28:22 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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, 18 May 2021 14:28:21 -0700 (PDT) Received: by mail-oo1-f48.google.com with SMTP id i8-20020a4aa1080000b0290201edd785e7so2556348ool.1 for ; Tue, 18 May 2021 14:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B2g2JRSsQZ//eH26cZ7fATp1Dk9J1UR7J8F/246LxfU=; b=qe9uUluvyo5qfW/lAXjrHizMBhYRQyNJDAppvL/7e5+GVLycSjikNSsklr2IKVsWKa ZlWvTkfcuXy6SXPmAaosP7Gx+cqG/C2m5JUAaZqOSnPF4FL1E4Rzw2Xmg7AS9uWIdkA0 gWtKGF03QnO9ifhiB+XE5v7MOv/Df2JY0pQeW7dwMNzba62ePXnGjZwKB0sxGy8+BPIO HLa2OM92Ggho23IBbnecGXGnGtEexTozTm3+C2JQ7/C0AzjMOLPYTdfyDoylke6CsJ4K NJwzx1unFViOr419zjTUOiOkEgeGJozjIsmwuoeEKONyqX/USFGuMj3gZEWUY3GVZOn7 6B3A== 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; bh=B2g2JRSsQZ//eH26cZ7fATp1Dk9J1UR7J8F/246LxfU=; b=TueiDX7xGGeBMRAUgWOQaAeHw5+kaQ3fvZizNaJo6myG2L6Fbo5VorMF0a/QiuIZtB /3sdH+DWEgLd/c+zbY+5byI6DRFzZ2iS55glWD3ANPyVVlJaUce19zA+TjRJksTc6/pj 2rkK3jvHqlua+Fky67jvpgYj77z3kn9hvWY8fHH4yT9wKp6LUG+xVYTu7vUrIXt7oVjz P/9TSUFnn2gyZHua4viM+m99DMGpn6/fKC9czuPzCRGz1/5/6tmpc8FAitYZ8JmiVx1o 7mEpmdhzhMTUt9Njdqs/JgP16Z+iJFGfsqOCIkEteIKRbuTshH45qXW3E24sAv6zw/P4 AHDg== X-Gm-Message-State: AOAM5318HcATBnvEEogqpHuzV/sUX4hM7TxoccD6N2K5vG8ZEGPVlJyP WqTpR+eRePNgPf3AZLbQAef2JERKq+FFkM7LABMi8/KtcMU= X-Google-Smtp-Source: ABdhPJxXvQWTt17Qk6tMyyG+3KorD4gRProihKIjseftczzbtwxv38xjOZDQB2MnFkd8qeDDsM5333UQ1W86hhiDj/Y= X-Received: by 2002:a4a:8311:: with SMTP id f17mr6022756oog.83.1621373301145; Tue, 18 May 2021 14:28:21 -0700 (PDT) MIME-Version: 1.0 References: <1565EB81-57B7-49B0-A47C-342E0088A432@trowski.com> <532D1413-52FF-4403-A20B-BBDB51163C85@trowski.com> <9c83ba12-79e1-4fc6-9a75-7a6b04965f03@www.fastmail.com> <38aa478b-dfd8-f62f-7803-5fc9499e5077@gmail.com> In-Reply-To: <38aa478b-dfd8-f62f-7803-5fc9499e5077@gmail.com> Date: Tue, 18 May 2021 22:28:09 +0100 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000a9c51d05c2a163ac" Subject: Re: [PHP-DEV] [RFC] Partial function application From: davidgebler@gmail.com (David Gebler) --000000000000a9c51d05c2a163ac Content-Type: text/plain; charset="UTF-8" On Tue, May 18, 2021 at 9:51 PM Rowan Tommins wrote: > Hi David, > > Did you see my message yesterday about the two mental models of the > feature? https://externals.io/message/114157#114492 > > Your expectation there is in line with the "start with an empty closure > and add things" model; the behaviour proposed in the RFC is in line with > the "copy the full signature and then splice in fixed values" model. > Well this is the crux of the issue for me, yes; I think the latter model is arguably more useful, I think the former model is what the proposed syntax implies and the former model is therefore the more natural and "readable" interpretation of what users might expect partials to mean when we're looking at hypothetical userland code built on this feature. I can't help but question the value of introducing something which has the potential to be ambiguous and misinterpreted - and I think the discussion in this thread has highlighted that there *is* ambiguity. Further, the RFC as it stands seems to introduce the possibility of writing ambiguous code when defining a partial. My intuition is that most PHP users would expect a single placeholder character (?) to represent one and exactly one parameter, analogous to SQL. But there are other ways you might reasonably interpret and argue for the syntax, which I think have been well-expressed by Larry and others. I don't know what the answer is here, I'm reading through the entire thread and RFC again and trying to better formulate in my mind how I'd [like to] reason about this in terms of syntax. But the more I think about it, the more I realise much as I loved the idea when I first read the RFC, now I'm worried we're rushing to include something (because there's an implementation, more or less ready to go) which maybe should go back to the drawing board for a bit of a re-think. Maybe I'm wrong, I don't know, but yeah...I have reservations now. If I had a vote and voting was open at this point, I think my inclination would be to -1 the RFC as it currently stands, not because it isn't a good idea but because right now, it will definitely confuse some significant proportion of users. > > I do worry that users of the language will assume the "wrong" mental > model, though, unless we pick a syntax that more clearly matches the > "copy and splice" model. I think that would mean having a way to say > "make this is a partial", and a way to indicate which arguments to > "splice", without any "placeholders". > > Yet Another Bad Unsolicited Syntax Suggestion: > > $partial = partial foo(); // no bindings; current RFC $partial = foo(?); > $partial = partial foo(b: 10); // bind named parameter $b; current RFC > $partial = foo(?, b: 10); > $partial = partial foo(1: 10); // bind positional parameter #1 > (zero-indexed); current RFC $partial = foo(?, 10); > > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000a9c51d05c2a163ac--