Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114167 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61216 invoked from network); 25 Apr 2021 21:30:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2021 21:30:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D9ADB1804DC for ; Sun, 25 Apr 2021 14:34:15 -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-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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:34:15 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id h36so31122302lfv.7 for ; Sun, 25 Apr 2021 14:34:15 -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=2coDxWco0nJry5rSCloQTMypKRAdwNtl5eZ7oUvt05w=; b=RvssOZauLYeYxlco1zsj243LBWLvlcwXhnvKu+gJfRf2drDOmTu+ssra7EE4KXpUH2 RTIqfunEpDH5mXBzIlA898OhgRnFfccwbtNWDy07ia+iivmSSZjnFTZ+DQY89Bj7R4Qz rH3UAVaHFf4W2vJLEYAjm91xms41a+nHidlkS+K3AMJbtR6gn8uXfUxUQWyspbdY7Tyd ABedba3ZcTNVDO4c0e9kmHeHBXyTMhg71La8pdfKIs3cAydyBWshRUfGloR35WkvDMvF hTEXMk7TKcPbl9z/4pF7ziQkEeDsNtVBCmOUVDRHXOhK5SY/OJwd32ri6ilZKi65l0kR bs6Q== 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=2coDxWco0nJry5rSCloQTMypKRAdwNtl5eZ7oUvt05w=; b=E6L7eVfMPjHm+gNadCKZqk5X7q/64bT8uQXeP/3mo+ZYeyy7RGNhwtC3Gl2LSPitYW oJMauYxDqTSIyVFDwFntoOt0SIze3/Qqo5fOZUlzwbF/oh4Wx8hv5EtPXyiGLVI2Q30V 1SK5LuQeG2RI9up4y7HcBooznYKQI05EbugM1uEEx441kKUMEifNzPxr43vXxs/c6evC QkCFttrp2PvwqOdGtvjS4wrExdg/mBqKdH+K1q+eoMSSSuxeT6pebIPBfCEgumpkUHZV 1+s2HGAnvIb+hMDpwRC38018UO1xcJz3WxyhpOccNd1nIA/yzHiZVm3Fq80jWtnfHjTo A0YQ== X-Gm-Message-State: AOAM533wM/JraMpp41NrXcmypPnDOLK/ar64AFLFj7SuZMXaBsUycu8+ Xuz/Yh6o5xkDj35P0H4Z6luhAIEwUKcEew0vcRg= X-Google-Smtp-Source: ABdhPJxymiihSi9T9wSRQZjL9yg0IQRTDHyBbF6hBEFjqVvXkfa7Ih//I/N6nBFU2vyRwY2W+4O55HSgEST7T0u1Qrc= X-Received: by 2002:a05:6512:3147:: with SMTP id s7mr10189986lfi.41.1619386452627; Sun, 25 Apr 2021 14:34:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:4e13:0:0:0:0:0 with HTTP; Sun, 25 Apr 2021 14:34:12 -0700 (PDT) In-Reply-To: References: Date: Sun, 25 Apr 2021 21:34:12 +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. > > -- > Best regards, > Max Semenik > By the way, for pipe operators to be really useful, it should probably be possible to combine with middleware. Olle