4 ms·
> it still has all the old issues like inconsistent core API Seriously, people keep bringing this up. Why? Are you a machine? Did you memorize the API to every
by jtreminio 7y ago
> it still has all the old issues like inconsistent core API
Seriously, people keep bringing this up. Why? Are you a machine? Did you memorize the API to every single language you write in? I type `strst` and my IDE autohints `strstr()` and the argument order.
> vague global context
What's vague about it? What does global context even mean in this sentence? Do you mean like super variables? Static properties? Can you provide some detail?
> Not to mention it still relies on running a separate, third party HTTP server, in contrast to Node.js, Java, Python
You _can_ run your website using only the built-in webserver for those languages, but are you really going to do that? Or are you going to put Nginx or Apache in front to do what they're made to do: be webservers? Hell, there's Unicorn, Passenger, Puma, all aimed at doing exactly this.
And surprise, surprise, PHP also has a built-in webserver you _can_ use, but shouldn't.
There's even ReactPHP, Swoole, Amp, all with webserver capabilities.
Sounds more like a person who knows PHP in passing, or may have used it lightly, or long ago.
- wyqydsyq 7y ago> Did you memorize the API to every single language you write in? No, that is my point. Languages with consistent core APIs are more easily discoverable, less error-prone and result in developers being less reliant on editor hinting. Writing PHP requires to you memoize random shit like the fact that json_encode() accepts options via bitmasks, inconsistent with the rest of the language for no apparent reason. > What's vague about it? - Imports/namespaces are not explicit (no intuitive way to know what methods are being provided by a given import without diving into it's file) - All HTTP input (remember, PHP basically exists to script HTTP responses) is magically provided through vague superglobals that are set to wildly different values depending on what HTTP server you use and how it is configured - Variables are all declared in global scope by default > You _can_ run your website using only the built-in webserver for those languages, but are you really going to do that? Yes. Unlike with PHP, running a single-process HTTP server does not result in thread locking for most other languages as their HTTP implementations are asynchronous by nature. There are currently some PHP community projects to implement async i/o, but there isn't even really any point trying to use them given PHP is meant to be having native libuv support eventually which will more or less make them redundant. And even then, why would you go to all this extra effort reinventing the wheel if not just to be stubborn and avoid having to learn a new language which is better suited to the task at hand? > Or are you going to put Nginx or Apache in front I hope you realise that other than for traditionally CGI-executed runtimes like PHP, Ruby and Perl, external HTTP servers like Nginx and Apache are almost exclusively used as a reverse proxy for things like load-balancing and SSL termination and have little to no involvement in processing and responding to the actual HTTP requests, which is typically left up to a HTTP server implemented in the application code. Sounds more like you have little to no experience with web services outside the PHP world.
- jtreminio 7y ago> Writing PHP requires to you memoize random shit like the fact that json_encode() accepts options via bitmasks Several other functions use bitmaps. It's a convenient way to string multiple options together without needing to pass key:value arrays. It's in the manual. My IDE typehints this for me. It's well documented. If you're surprised by this it's because you're using a text editor. Do folks write c# outside of Visual Studio? I can imagine some people might enjoy writing Java in notepad.exe but that's simply not for me. Why would I subject myself to this? Why make programming harder than it need be? > - Imports/namespaces are not explicit (no intuitive way to know what methods are being provided by a given import without diving into it's file) So you need to know ... what you're importing. This is difficult for you? If you don't want your IDE to typehint on the namespace, you need to open the stuff you imported. Honestly, you're reaching. > - Variables are all declared in global scope by default I don't understand why you would think this is unique? Any variable declared in the global scope is ... global scoped? https://playcode.io/317387?tabs=console&script.js&output https://playcode.io/317387?tabs=console&script.js&output If you look at RoR, running `rails server` spins up a webserver using Puma. Why wouldn't RoR use whatever built-in webserver Ruby ships with? I admit I am not as knowledgeable in Ruby or Python as I am in PHP, but what I do know is that a 5 minute Google search shows me that very few places on the internet recommend exposing Ruby or Python directly to the internet, and instead Unicorn, Passenger, etc are recommended. Why is this even a point of contention for you? Why would you think doing this, or being able to do this, would be a positive?