Live data from Hacker News

PHP 8.5 alpha 1 is available for download

php.net

1–10 of 19 posts

Re: PHP 8.5 alpha 1 is available for download

#6

8.5 notably includes the new pipe operator: https://stitcher.io/blog/pipe-operator-in-php-85

I feel like if you treat temporary variables as documentation they feel less icky. All these examples with the pipeline operator cause way more mental overhead than reading temporary variable names.

Re: PHP 8.5 alpha 1 is available for download

#7
post #6

8.5 notably includes the new pipe operator: https://stitcher.io/blog/pipe-operator-in-php-85

I feel like if you treat temporary variables as documentation they feel less icky. All these examples with the pipeline operator cause way more mental overhead than reading temporary variable names.

I think it really depends on what operations you are applying. Having one succinct named variable like $slug with a few simple pipeline calls like in the example is "self-documenting" and easy to read. However, some lambdas and non-standard function are definitely a place for nicely named temporary variables in my opinion.

Re: PHP 8.5 alpha 1 is available for download

#9

8.5 notably includes the new pipe operator: https://stitcher.io/blog/pipe-operator-in-php-85

Kind of a clunky and verbose syntax at the moment. I wonder what languages get pipe syntax right?

Obligatory: Raku supports pipe in both directions, passing input as the last parameter instead of requiring the function to take only one parameter. It also has a shorthand:

my @array = ; my @final-array = @array.unique.sort.reverse; say @final-array;

Re: PHP 8.5 alpha 1 is available for download

#10

8.5 notably includes the new pipe operator: https://stitcher.io/blog/pipe-operator-in-php-85

Kind of a clunky and verbose syntax at the moment. I wonder what languages get pipe syntax right? Obligatory: Raku supports pipe in both directions, passing input as the last parameter instead of requiring the function to take only one parameter. It also has a shorthand: my @array = ; my @final-array = @array.unique.sort.reverse; say @final-array;

There is a complementary Partial Function Application RFC which, among other things, solves the one-parameter limitation. It allows a question mark to be substituted in for the piped value:

$foo |> str_replace('hello', 'hi', ?);

https://wiki.php.net/rfc/partial_function_application_v2

Post reply on HN