Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114830 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16288 invoked from network); 11 Jun 2021 12:26:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Jun 2021 12:26:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7C9441804C9 for ; Fri, 11 Jun 2021 05:42:11 -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.4 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,URIBL_SBL,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 ; Fri, 11 Jun 2021 05:42:11 -0700 (PDT) Received: by mail-ot1-f49.google.com with SMTP id h24-20020a9d64180000b029036edcf8f9a6so3010264otl.3 for ; Fri, 11 Jun 2021 05:42:11 -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=C8OOuHP6n12Z0WVnwFc4OOZCOmMCf5rKsWHtiTiCZzo=; b=l0iAyCSeRWFyx5mxjflAPJ8mkqIRbTBnkmJDExBxTzcK0zz/1MJDPvltrEZE9qt+IG Z2gSY4kCvZcDZIFmwfnV33OTOX78qwgB/Mxatxx4LqXGyr54kp7Uc8n0fKnORs4KUZ/d pycT1vscYrSTt9xbXiqy3pvPpccvJEAqHZse4rFv+Ulz8RcPYk+aYJoTdifZDauXh0S3 MyGsTvRQKpm6mo92ertjlYY8SXZah77gyeBPE/YIHJTdQaujl2TJkQFbFL2gXJY0+p27 6AF+H7PkXODeq9kjGgn9qayBT0yiO2UOaaCQyqVLwa2IjemdCtnwmq3oAludEmduP5L/ QuRA== 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=C8OOuHP6n12Z0WVnwFc4OOZCOmMCf5rKsWHtiTiCZzo=; b=lg+hRX+Q2MZeMrXKVmyafXPPKoz3092kg59bBgn7yRvoVY/Djx6m+0Sfp/e+IjN76U t2KkaHsrWDKwbWz9Rs7g9x8e5PgyI2Hk3P4Mc6wks0JKuiyBN5WxPWo1mIjNHi1fNtyf h75+yfCeMJYCApNRNyMyrt3Q/PMfu6QTtbLTwQv5YcMuaNNuBL0df9K19YJMU/vqpGhm /9HDYr01YABM7kg79GAzrCAuzP7kHu6Uoq1+JuGn+nLxHoYS24lfimaI9b5TvzHXbQjI nfwptZVMggxWjxKiyo8QOA0U/3HV7P6mqvvJg1VvSC1EmNPfBJTm8col8FpBMf/gjGeW LV4g== X-Gm-Message-State: AOAM530ZAb58rRChb0AWMV9P40vrN52Y1BdT/s1Qbg7/L2S7U8UHJkMX epVLVtwMe/p0IliQEI69B+ZkOtwCT6rLvYronU0= X-Google-Smtp-Source: ABdhPJxSVr6Q0eG69I5uBHggszoxvcBT7eNuPLtK5Y+WIueBxOYbBM8M3YBo6lfPl4ildu9sj3uM3A/xsSuM9Hqem98= X-Received: by 2002:a9d:39e3:: with SMTP id y90mr3037238otb.257.1623415330298; Fri, 11 Jun 2021 05:42:10 -0700 (PDT) MIME-Version: 1.0 References: <9adf063b-2598-4dd4-9e2b-cf2cd4f53b86@www.fastmail.com> In-Reply-To: Date: Fri, 11 Jun 2021 14:41:59 +0200 Message-ID: To: Guilliam Xavier Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="00000000000015df1c05c47cd6d3" Subject: Re: [PHP-DEV] [RFC] Partial Function Application, take 2 From: krakjoe@gmail.com (Joe Watkins) --00000000000015df1c05c47cd6d3 Content-Type: text/plain; charset="UTF-8" There's a couple of typos in the RFC, which Larry will fix when he has time. There was also a typo in patch, and a fault in patch. All fixed. pending tests, 3v4l won't update until tomorrow. Cheers Joe On Fri, 11 Jun 2021 at 13:02, Guilliam Xavier wrote: > Sorry, me again :s I have tested the examples from > https://wiki.php.net/rfc/partial_function_application on > https://3v4l.org/#focus=rfc.partials and several of them currently give an > error: > > - Ex 10: on the line `$c = stuff(?, ?, f: 3.5, ..., p: $point);` > => Fatal error: Named arguments must come after all place holders > (typo I guess, `$c = stuff(?, ?, ..., f: 3.5, p: $point);` is OK) > > - (Ex 11: no error but a typo: `'hi'` vs `'foo'`) > > - Ex 16: for the last call `(four(..., d: 4, a: 1))(2, 3);` > => Fatal error: Uncaught ArgumentCountError: four(): Argument #2 ($b) not > passed > (on the function definition line) > (`(four(..., d: 4, a: 1))(2, 3, 5, 6);` idem, > but `(four(..., d: 4, a: 1))(b: 2, c: 3);` throws an "Unknown named > parameter $b" Error on the call line) > (weird) > > - func_get_args() and friends: one the last line `$f(1, 2);` (after `$f = > f(?);`) > => Fatal error: Uncaught Error: too many arguments for application of f, 2 > given and a maximum of 1 expected > (can make sense, e.g. https://externals.io/message/114532#114554 ) > > - (Callable reference: no error but a typo: `$f` vs `$foo`) > > - Optimizations: on the line `$boo = $baz(4, ...);` > => Fatal error: Uncaught Error: too many arguments and or place holders for > application of Closure::__invoke, 1 given and a maximum of 0 expected > (`$boo = $baz(?);` throws the same error, > but `$boo = $baz(4);` throws a "not enough arguments for implementation of > foo, 4 given and exactly 5 expected" Error, > and `$boo = $baz(...);` makes the subsequent `$boo(5);` throw a "not enough > arguments ..." Error) > (weird, looks like `$bar = $foo(2, ...);` and/or `$baz = $bar(3, ...);` > dropped too many params) > > Regards, > > -- > Guilliam Xavier > --00000000000015df1c05c47cd6d3--