Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114503 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4074 invoked from network); 17 May 2021 15:25:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 May 2021 15:25:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C6A58180544 for ; Mon, 17 May 2021 08:34:49 -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_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-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 ; Mon, 17 May 2021 08:34:49 -0700 (PDT) Received: by mail-lj1-f170.google.com with SMTP id p20so7763531ljj.8 for ; Mon, 17 May 2021 08:34:49 -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=v9+aYlREaIB//Z4cToYdW2Y8HFN4V2oeRiM/FeO4eyk=; b=hPxOiTIIg+xsGPwo/qHnUxP1ju/mG4w7RYzLN5wMwX4DyP8jlwHbzKPSYIXu54TCqT 1wrG3JosxG7j6/9NOALV/aQ7feROgJVTaYs7+Bbh/y7eo0yMU1+Bwk4TcI0P0MyCwo4G 6yKE10bioYR9s7+QfRDLkYb6SZUpwpCAzpMupWx5VmxlOJAUHo0+xv2gJ9H3DPekN/g8 AI80ZM6hUfkwfKPlw+PnbAD80xOZuhwQkwBBlnKJrl3znAAC8tbpopcfEz+SRI7qBRab InhAnFmTFh2F+z1z8E+1sSWmDLtVZom1WlRmpZHdod857kEZueVtdZmMza8gA0uAr2M7 my+w== 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=v9+aYlREaIB//Z4cToYdW2Y8HFN4V2oeRiM/FeO4eyk=; b=J5XtkpwxbusbgO4b6Mzue0RYpYfgr0C0em95+i7F2j3XQ6dSYed9swq1cen++hYZ17 SS8mk2iyFKlvYcPR7oWN4EpSn3vquPvNOWBIZEw8EyniGNSlA1LDverYFfFG/PJ5nmZd WY9rJH7vt7uih3zHWCanBJTHr8Rwd3Cg+Y9klaj3jFUeeg04MSWUX+PR97EI7J0bWp2d JEIJMs5Jbgm6xKLs631PsP2U1ssT/T7/iDb9C5hZQhOCrTh6dggOFQKhpgmhI3rl7Pgj Pdol3m5lp5P8pXbRnJvCcLv5+/DuS0WteBOTybTKkokmsCIGL6mVRQr9v/IhoOGP0rgC evQg== X-Gm-Message-State: AOAM531rbcBiRhBWGSc8a4zo7znf7lriXLuqc1csGLJYSWSNgWM+J+7J uIaYxZdihkwOc+tO1h3O5qW14bwo5d4cExiHAA== X-Google-Smtp-Source: ABdhPJxJu79YxCurSPl1YNKZn7aX+HQ18nAZtrj2/WYJKBX750RJHcqHnkXf3WMimX+2UUkeMZ/7eDzH7z/C61al4PE= X-Received: by 2002:a05:651c:329:: with SMTP id b9mr61045ljp.128.1621265687948; Mon, 17 May 2021 08:34:47 -0700 (PDT) MIME-Version: 1.0 References: <1565EB81-57B7-49B0-A47C-342E0088A432@trowski.com> <09B663C3-E21D-432B-BB7F-78312F827C30@newclarity.net> <5B96C4C4-A324-4EF8-8196-83480E897884@newclarity.net> In-Reply-To: <5B96C4C4-A324-4EF8-8196-83480E897884@newclarity.net> Date: Mon, 17 May 2021 17:34:36 +0200 Message-ID: To: Mike Schinkel Cc: php internals Content-Type: multipart/alternative; boundary="0000000000006aaf1c05c2885567" Subject: Re: [PHP-DEV] [RFC] Partial function application From: guilliam.xavier@gmail.com (Guilliam Xavier) --0000000000006aaf1c05c2885567 Content-Type: text/plain; charset="UTF-8" On Mon, May 17, 2021 at 5:16 PM Mike Schinkel wrote: > > > On May 17, 2021, at 10:50 AM, Guilliam Xavier > wrote: > > > > On Mon, May 17, 2021 at 6:58 AM Mike Schinkel wrote: > >> > >> > Well, I was thinking that by changing the proposed syntax we could >> achieve >> > what is proposed and a little bit more. >> > Also we wouldn't need to worry about the number of ? needed as >> arguments. >> > Since all we need is to mark the return type as partial (closure) on the >> > fly and grab hold of what is passed as arguments. >> > >> > There are some different syntaxes that come to my mind: >> > We could still use ? but outside of the arguments list? >> > ``` >> > $partial = xyx?(..); >> > $partial = ?xyx(..); >> > ``` >> > or maybe different symbols: >> > ``` >> > $partial = :xyz(..); >> > ``` >> > >> > We might be able to even cast the return type: >> > ``` >> > $partial = (?) xyz(..); >> > $partial = (partial) xyz(..); >> > $partial = (fn) xyz(..); >> > ``` >> >> Casting is another interesting approach that does feel more consistent >> with the existing language. >> >> Since it *is* creating a closure, wouldn't this make the most sense? >> >> $partial = (closure) abc(); >> > > Ouch! definitely NOT! > > >> $partial = (closure) xyz(?,24); > > > > Mind if I ask for you to elaborate on your aversion? > > Asking for general understanding, not to debate the point. > > -Mike > Sorry I was too "raw". I mean that the cast syntax `$p = (whatever) f();` already very clearly means/does "evaluate f() [i.e. call it], then convert the evaluation result to whatever, then assign the conversion result to $p", and I think it would be a **very bad idea** to "reuse" the same syntax for something that wouldn't call f() immediately. I'm favorable to other syntaxes, but which don't look like a cast. Regards, -- Guilliam Xavier --0000000000006aaf1c05c2885567--