Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114166 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59795 invoked from network); 25 Apr 2021 21:27:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2021 21:27:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 180251804BD for ; Sun, 25 Apr 2021 14:31:02 -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-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.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 ; Sun, 25 Apr 2021 14:31:01 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id n138so85420885lfa.3 for ; Sun, 25 Apr 2021 14:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LoPtqHxKHNuoxS8WnILjH7s4jIDJdZnQDc4Bg3eCwxk=; b=guW0shSRHXwhe9isC3iyds6axCUclNdOaHAApPj2pSZKDLHE5wiggoTdNw6j/0XV7W oTnLTzTGRL+DMxFMo1E4/ij+Z0HJtOG/gMF97ZDfa/xT7v3e+TLyLbWKbkmj3FQ1Ss/j QOWs4rqHYthr1oIE9VOgC47KJdlImccfDC/vkA4ffiOf8E53RDKzzm5GoXdeiPRdg4FR 0vwmxAoZsgvRMsolQxYvWqvbkE8WSbGTIBgFxwMvFL5GGT3lP4X+866LtVfCh4pmrdyy d7XeH5cxybXJnHt/BW5aMQPC0ITlYYevtrvgDk1HAwFqI9Pm+qu/c3cQYM2h1Fi3utBl zAHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LoPtqHxKHNuoxS8WnILjH7s4jIDJdZnQDc4Bg3eCwxk=; b=XpvKAVLzrEAsgNTHMojop2QGDV1nF/AC/A1+KFvnARtxtDbzcHxUdO+OUIs/gnDL+9 F1SsuunGgprEs406t5oi4GSc5dzV1E5AimX8m6bYaJdTkll83b4fqAbBqCMNwKli65XC /HgZUgWSYGLqPsyoYw62pbNcvPNsQSS5V0s/oYx3dhvzAHlrJ53jV/3HdOVHYS0k7SGY rM4R4yB21P6g0AfQsaOP299Dcq3XamMhVHrr+Cdf+pWZZZqpFgDFAQcbfZ5VGTyzQrcS WK+upYat35W+XH6DRfIS7GJDvQnhy4uXjznQSR/Z1K6lOgVez6KVfrDX8wPTjx0skYe0 Djxg== X-Gm-Message-State: AOAM533kzMeNWoT92GlM/V6r505wuOP76ywwAsCuGVCtDRkr4UlAL48H sCNIkXIViEVmbSY3pGEaUJ6alvN93TLx+eoim64= X-Google-Smtp-Source: ABdhPJxvpietG8+e7tx9sTT8qeEQ/DhvkoVlO1/CMpukdavsn3eeGjrnSudj1IHDouy5Yrw0YZ38eYZDZQ1Wi415hVU= X-Received: by 2002:ac2:551a:: with SMTP id j26mr10217779lfk.61.1619386258541; Sun, 25 Apr 2021 14:30:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:4e13:0:0:0:0:0 with HTTP; Sun, 25 Apr 2021 14:30:57 -0700 (PDT) In-Reply-To: References: Date: Sun, 25 Apr 2021 21:30:57 +0000 Message-ID: To: Max Semenik Cc: Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Partial function application From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) 2021-04-25 21:07 GMT, Max Semenik : > On Sun, Apr 25, 2021 at 10:26 PM Larry Garfield > wrote: > >> https://wiki.php.net/rfc/partial_function_application > > > Amazing, I've wanted this for so long! Have you considered extending thi= s > syntax to OOP, e.g. $obj->method(?) or SomeClass::staticMethod(?)? > > On Sun, Apr 25, 2021 at 10:51 PM Olle H=C3=A4rstedt > wrote: > >> Nice. :) Are there any other motivating use-cases besides pipe >> operator (that are relevant for web dev)? > > > One reason I'm personally excited about this proposal is that it would > allow static analysis in more cases, e.g. > > $param =3D 'fooBar'; // What's this string? A user name? Elon Musk's favo= rite > color? Text of US Constitution? > > somefunc($param); > > function somefunc($cb) { > $cb(123, 'meh'); // What parameter types does this accept? > } > > Allowing syntax like $param =3D fooBar(?, ?); would indicate clearly what > this variable receives. Analysis tools would then be able to check if suc= h > a function exists and whether it would receive parameters of expected > types. Like an alternative to value objects (`class Email ... `)? Not sure I understand how, sorry. Olle