Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114461 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 54590 invoked from network); 13 May 2021 13:36:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2021 13:36:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D54C61804BD for ; Thu, 13 May 2021 06:44:53 -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 06:44:53 -0700 (PDT) Received: by mail-yb1-f180.google.com with SMTP id m9so34857164ybm.3 for ; Thu, 13 May 2021 06:44:53 -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=DQjDyRqXgBuinmyF6iGCfVJVyp+EuRlERYOvyqaXTiM=; b=Tv6nww4cZOzT8m/0ciVKsIJGC3hiPdtHWyrWHchc8HZgu+KbbpEy0i9GB2078iZzM9 L3+kSzjz/lNQYD1G1oa9WldLlF+V0dJILGyy4xbkjlJrQkUjzQ7AYcpVdlVm/vCZpZz2 quZSxNL/clL1b9qiwGrYan47RiYIoBNW2NXIw= 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=DQjDyRqXgBuinmyF6iGCfVJVyp+EuRlERYOvyqaXTiM=; b=rpUSRGvbj19ah2xC2HcsWO/LcDT6R8sKM/QQ1JVGxMNjGKZfnDQJzpvUHLlS8Wk3RK kIW888y3CaNnzCCD128ED3/rqfkdKqQSH8C0bDduwPyD82pMhyeB6Xpm7ox8sJgZjiap ZBU5ZZS/ZZXOqkvWI2RbDgHg80dHVdON9xQrnpMyPHqRgIQwzbis8JM4xvxadLroVhNZ ItSR/cixJblmE2Fe88CCgmSN4j6VHYpJXjI6m4PTOkSCv+8yc0SKvTWOdinMdBrLN4YB xWr7KfODZmQalgdJoyIEx5iOfyUnkd0uCgCsjljfrU6nX+PGMnHMT0bAZtZrq0eTd6ga 2SHQ== X-Gm-Message-State: AOAM530QKF8mrem0reRLjb5YcRw/oSvJo+7pjrzWkPTtXtQ9jPD4LSCZ hAWd00+/Ylwl7+c4pxlLxiFOv37TnfK3ErjwNTVTJg== X-Google-Smtp-Source: ABdhPJwg9zZnpEyISMQvvC/l1Cn/Epk3PTRwvFHiT2Q1yx70VaewkECkmTgpJA1m83yfgTIzFRFksVdYMyt/9AFwn34= X-Received: by 2002:a25:2342:: with SMTP id j63mr1048864ybj.85.1620913490930; Thu, 13 May 2021 06:44:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Thu, 13 May 2021 07:44:40 -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 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.