On Thu, May 13, 2021 at 2:45 AM someniatko <somenia...@gmail.com> 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. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php