5 ms·
"It has no async/multi-threading either, so probably JavaScript is less-bad." Screwdrivers are really that bad, you can't even use them to pound a nail properl
by mns 6y ago
"It has no async/multi-threading either, so probably JavaScript is less-bad."
Screwdrivers are really that bad, you can't even use them to pound a nail properly...
- ragnese 6y agoWhat? PHP is a language primarily for backend web server code. Having async is huge for performance on the backend, which is mostly IO bound, rather than CPU bound. So, I think you have it backwards. Async is unnecessary in many places, but backend is the place where it's very important.
- mns 6y agoPHP started as a scripting language and had/has many other issues and fundamentals that had/has to get right first. Don't blame PHP or Javascript for things they were not initially built and meant for, when there are other languages out there that can do what you need and have a more solid and tested foundation.
- ragnese 6y agoSo what is PHP for, then? Everyone seems to be using it for backend web projects. In my opinion, it has no valid use case that isn't done better by something else. The only thing I can think of is for shell scripting when your bash script is a little too long. It's also been around for, what, 30 years, and still hasn't changed its broken fundamentals. And it isn't going to. It needs to be deprecated. It's run its course.
- mekster 6y agoAnd your recommendations are?
- ragnese 6y agoFor backend? Kotlin. Hands down. All the benefits of the mature Java ecosystem, but with a language that is vastly superior to Java, itself. You get coroutines, threads, strong static typing, etc. Not the perfect type system, because it's still limited by the JVM, but much much better than Java, PHP, etc.
- zowanet 6y agoJavaScript's async features are made possible because of its event loop (Node.js is essentially V8 + libuv). You can use one of many event loop implementations with PHP, including libuv, if you so wish.
- ragnese 6y agoSure. But JavaScript has Promise built in to the language these days. With PHP you'd have to use a third party extension, like swoole, if you want something like that. Or write your own, of course. But should we need to do this for a 25 year old backend language?