←back to thread

PHP 8.5

(stitcher.io)
201 points brentroose | 8 comments | | HN request time: 0.825s | source | bottom
Show context
f311a ◴[] No.45990126[source]
PHP becomes a complex language with each update. For what reason? Its application is still limited to the web, mostly.
replies(4): >>45990206 #>>45990222 #>>45990339 #>>45990423 #
1. dotancohen ◴[] No.45990206[source]
I downvoted you before reading the fine article. I'm back to correct that.

The new array_first() and array_last() functions are nice, everything else is either reimplantation of existing features or "features"which will make maintainability more difficult. The pipe operator is one such example. I don't need it - these nested methods are not really an issue in any codebase I've seen. The new syntax only works for unary functions, so higher arity functions must be wrapped in an arrow function. It's a mess and more bug prone than just nesting the functions.

replies(5): >>45991162 #>>45991537 #>>45992150 #>>45992480 #>>45994526 #
2. pbowyer ◴[] No.45991162[source]
> The pipe operator [...] syntax only works for unary functions, so higher arity functions must be wrapped in an arrow function.

It's coming - but to get PHP RFCs to pass they have to be salami-sliced, otherwise they're voted down.

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

3. ljm ◴[] No.45991537[source]
The pipe operator makes it much easier to create home-grown cryptographic hash functions, as everybody used to do in the early 2000s:

    md5($password)
    |> sha1(...)
    |> sha1(...)
    |> md5(...)
    |> rot13(...)
    |> crc32(...)
replies(1): >>45991653 #
4. dotancohen ◴[] No.45991653[source]
Oh, now I'm convinced!
5. dgb23 ◴[] No.45992150[source]
Many of the newer features have this problem. Like the match keyword, enums, closures etc. They are half-baked versions of what could be powerful and expressive features.

Meanwhile it seemingly abandoned features and unique selling points, like the in-built templating, associative arrays with value semantics and the fact that it integrates well with C or the simple fact that it can be used to write web server scripts very easily. To me, many of these cool features have been largely ignored or even moved away from.

6. philipwhiuk ◴[] No.45992480[source]
I'm sort of on the opposite side. I'm unconvinced by extra functions for arrays in the global namespace and I'm happier about syntactic improvements and debugging improvements.
replies(1): >>45992932 #
7. dotancohen ◴[] No.45992932[source]
I'm glad to hear a dissenting opinion. Interesting that we experience PHP differently.

What is your background? I've been working mostly with PHP and Python for about 25 years. Do you come from e.g. Java?

8. array_key_first ◴[] No.45994526[source]
I don't understand how this is more bug prone. The nesting is a HUGE problem because it's extremely unreadable. The arrow is much more readable, and array functions are very simple too.