Most active commenters
  • dotancohen(3)

←back to thread

PHP 8.5

(stitcher.io)
201 points brentroose | 15 comments | | HN request time: 0.001s | source | bottom
1. 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 #
2. 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 #
3. Xenoamorphous ◴[] No.45990222[source]
The web is not getting any simpler.
replies(2): >>45990527 #>>45991551 #
4. mhd ◴[] No.45990339[source]
A lot of C# and Java code is oriented towards web backends, too. Which are quite big and complex. So it seems natural that languages in the same design space (trad OO) converge on similar features. I think the only exception these days is Go.

I think these days you could change "You can write Fortran in any language" to "You can structure your code like Spring in any language"…

5. nunodonato ◴[] No.45990423[source]
Obviously you haven't heard of NativePhp :)

Still, even if it was "just" the web, why wouldn't it evolve? It's a great language, with a big user base, and there's always room for improvements and to increase the developer experience

6. Cthulhu_ ◴[] No.45990527[source]
Exactly, I'd even argue that web development (back & front-end) is by far the largest job / industry in software development.
7. 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

8. 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 #
9. f311a ◴[] No.45991551[source]
I don't see how making a language more complex can help with that. Complex languages makes sense for system programming where you want to squeeze some performance.
replies(1): >>45994507 #
10. dotancohen ◴[] No.45991653{3}[source]
Oh, now I'm convinced!
11. 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.

12. 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 #
13. dotancohen ◴[] No.45992932{3}[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?

14. array_key_first ◴[] No.45994507{3}[source]
Making a language more complex often leads to simpler code. Keeping a language too simple often forces overly complex code.
15. 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.