Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114462 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58692 invoked from network); 13 May 2021 14:22:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2021 14:22:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CBC161804BD for ; Thu, 13 May 2021 07:30:34 -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,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-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (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 ; Thu, 13 May 2021 07:30:33 -0700 (PDT) Received: by mail-yb1-f180.google.com with SMTP id e190so34949328ybb.10 for ; Thu, 13 May 2021 07:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2RvvgDP17+3wHkFaaKeFjLnCHZHnYDtiOEawEguOQqA=; b=EEygJ6F+HKtNCsDtjYP9NOvnhjr5pxHoMz5t9/4QuGergLletZhTcpyEQZ6KLN0ShK h3x1HCagXh7TFczRAsBRfazBOLcU87/jRBlpug3+jyOHXHrRktpvk+NUtWiT0DtKSku1 pzORr5cfAJqOCQY3D79bH4SNwCkon6c1Irszo= 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=2RvvgDP17+3wHkFaaKeFjLnCHZHnYDtiOEawEguOQqA=; b=KQ0eAxzAhafks72J5WAeGQCiVn1DyiCEp2O4IgQB/zAw7BKm1ETNm52xiUMtPHMfbO S6TLapcRab8WTj/kwAtyCMu1+TIVwowLOtpPHCG2TbzQnMoID320Aq906WT3pfRZ96LH pAbs0dyI7+iSi5xlpxrWd1sHKJ4uuYRsdG+B0oG1g8sMV3UMTBmwUaVQ4axFleEqswFS 2NXkKXTZ7wi7GQQTVfpcFKJOQfbS7KqSbpjY0IcA7bPlu9Z1P0Ylxlpdbme8lzijhBQT /9fw+2xcHopetD8je6/tVBwxa4zKmIcPEgy3XqJPSLdImYx8NBubwnzVb7Bve9tVgs+1 SXZw== X-Gm-Message-State: AOAM530kEMUEVM4c988rtBE8uMA1k6z9jcxwxAKBajGueyshaTJLvoqE p1eFpq0D/KkPBGyE8gef+mQZvB6qtDqQIA8hExzCwQ== X-Google-Smtp-Source: ABdhPJxRfHY8oh5DzVx+whk3Y/Plxzx59/eW4QGt7NuRWfKCnx97flsGRLokHQWSTaKhgl3g5qqNGBHcm17s/A6jjes= X-Received: by 2002:a5b:749:: with SMTP id s9mr56264672ybq.153.1620916232941; Thu, 13 May 2021 07:30:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Thu, 13 May 2021 08:30:22 -0600 Message-ID: To: someniatko Cc: Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Partial function application From: internals@lists.php.net ("Levi Morrison via internals") On Thu, May 13, 2021 at 7:44 AM Levi Morrison wrote: > > On Thu, May 13, 2021 at 2:45 AM someniatko wrote: > > > > > Greetings, Internalians! > > > > > > I would like to offer for your consideration another RFC, specifically syntax for partial function application. > > > > > > https://wiki.php.net/rfc/partial_function_application > > > > Thank you again for one more wonderful language change! I am sure this > > is a huge step into the correct direction for the language. One of the > > nice side effects of this proposal is that it is great for reducing > > visual clutter when being used in functions like `array_map()`, > > `array_filter()` etc. However, I have a small nitpick, which may > > probably be a bit hard to implement: what about partially applied > > constructors? They are sort of functions as well. For instance: > > > > ```php > > $strings = [ 'value-1', 'value-2' ]; > > $objects = array_map( > > fn (string $s) => new ValueObject($s), > > $strings > > ``` > > > > to be turned into > > ```php > > $strings = [ 'value-1', 'value-2' ]; > > $objects = array_map(new ValueObject(?), $strings); > > ``` > > > > There is unfortunately no mention of partially applied constructors in > > the RFC. If it is not implemented as above, could you please consider > > adding it to the Future Scope probably? > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: https://www.php.net/unsub.php > > > > The GitHub PR supports this, and there is even a comment there saying > we should show this in the RFC. We'll get that updated. I was a bit too hasty. In further review it does do something, but not what you'd want in situations like this. We are discussing among authors whether it is technically feasible to support the expected behavior at this time.