Live data from Hacker News

I still love PHP and JavaScript

the.scapegoat.dev

261–270 of 402 posts

Re: I still love PHP and JavaScript

#261
post #33

Earlier quoted context omitted.

> - no "unknown unknowns". it's so tried-and-true, there's no surprises This part is laughable. People who have been programming PHP for 20 years (several of them at my company) still routinely discover hidden bugs, quirks or general behavior that is totally unintuitive and nowhere found in the documentation.

I’ve been using PHP since 2003 and it’s my full time job and this doesn’t ring true. Very, very rarely is a gotcha not in the docs comment section.

> in the docs comment section.

A classic boiled frog statement.

__It's not undocumented, someone posted a comment about that bug...__

I will quietly place my face in my hands and weep to the memory of php coding I did 20 years ago.

Seems the same nonsensical masochism is still going strong.

Re: I still love PHP and JavaScript

#262

Earlier quoted context omitted.

That's what makes the statement "no 'unknown unknowns'" a bit ridiculous though. How can you possibly assert that there are absolutely NO 'unknown unknowns'? You can never rule them out, and at best can only suspect there's a possibility either way, that they do or do not exist. You can never actually know with certainty.

Schrödinger’s Cat?

Schrödinger's PHP.

Re: I still love PHP and JavaScript

#263
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

Back in the day when I wrote PHP code it was not pleasant to work with UTF-8 - is it better now?

Re: I still love PHP and JavaScript

#264

Earlier quoted context omitted.

I’ve been using PHP since 2003 and it’s my full time job and this doesn’t ring true. Very, very rarely is a gotcha not in the docs comment section.

> in the docs comment section. A classic boiled frog statement. __It's not undocumented, someone posted a comment about that bug...__ I will quietly place my face in my hands and weep to the memory of php coding I did 20 years ago. Seems the same nonsensical masochism is still going strong.

I mean, I am by no means an expert in PHP, and in fact most of my knowledge of it comes from hating on it (or having been thrust into the unfortunate position of being the system administrator for a popular MediaWiki instance), but even in my limited experience with it from a couple lifetimes ago I know that most of the documentation for PHP is crowdsourced in the documentation comments section. That might be depressing, but that isn't what that comment was defending: it does feel likely to be true that there aren't many "unknown unknowns" waiting for you in PHP.

Re: I still love PHP and JavaScript

#265
post #162

Earlier quoted context omitted.

I’ve been using PHP since 2003 and it’s my full time job and this doesn’t ring true. Very, very rarely is a gotcha not in the docs comment section.

That’s just it. I have to code with the PHP docs open like some kind of arcane recipe book.

Get a better IDE. Visiting docs for checking return values should be a thing in the past.

Re: I still love PHP and JavaScript

#266

Earlier quoted context omitted.

I’ve been using PHP since 2003 and it’s my full time job and this doesn’t ring true. Very, very rarely is a gotcha not in the docs comment section.

> in the docs comment section. A classic boiled frog statement. __It's not undocumented, someone posted a comment about that bug...__ I will quietly place my face in my hands and weep to the memory of php coding I did 20 years ago. Seems the same nonsensical masochism is still going strong.

When I had to code in php I've written a css-rule for my browser to hide the user contributions to the docs, since they where often misleading if not plainly wrong.

I remember no discernible border between 'official docs stop here' and 'user contributed opinions start here'.

Re: I still love PHP and JavaScript

#267

Earlier quoted context omitted.

I’ve been using PHP since 2003 and it’s my full time job and this doesn’t ring true. Very, very rarely is a gotcha not in the docs comment section.

i always found those comment sections to be so odd — fifteen year old comments about a common pitfall and the information never makes it up to the official documentation? i suppose it's fitting for a web-centric language to crowd source its docs on a website, but does any other mainstream language do this?

If it makes you feel any better, at least the comments are next to the documentation? Really big projects that people rely on every day -- things like Rust's Cargo or Google's Flutter -- are riddled with bugs and limitations, requiring frustrating boilerplate workarounds to make basic things work correctly, and they generally only have mention of the problems in the comments on the billion 5-10 year old open issues in their task tracker.

Re: I still love PHP and JavaScript

#268

I think that php has some weird disk usage behaviour that makes running Wordpress in a docker environment slow. I don’t know exactly what it is but I would say it is a weird behaviour of php anyway.

You need to make sure disk writes are against mounted volumes and not against the CoW filesystem in the container but that's a docker thing not a WordPress thing.

Re: I still love PHP and JavaScript

#269
post #245
post #208

Earlier quoted context omitted.

Ruby, Python, C#, Java, and JavaScript are all are more predictable and just as useful. Go, Elixir, Clojure, and probably others are more predictable while being less "useful" only in the sense that they may have less convenient deployments or less mature web libraries.

I've used Python, C#, Java, JavaScript and PHP, and in my experience Python is the most unpredictable of these languages. Just to name a few: - mutable default arguments - late binding closures - typings that are purely documentation instead of being enforced Labeling these things as "gotchas" doesn't make them predictable imo.

Python less predictable than PHP? In what world? In PHP standard library functions silently take a null instead of a string, even though they are string handling functions, hiding that mistake for the user of the language, until a later point in time, when the context has been lost and one needs to do silly debugging, until one finds the place where the null first was handled, while it should have raised an error. Such is the silly character of PHP standard library. Many functions also have multiple return types, which makes it difficult to simply use the result of one as input to another.

If predictability means to predict, that standard library will behave nonsensically, then yes, PHP has the one high predictability.

Re: I still love PHP and JavaScript

#270
post #255

Earlier quoted context omitted.

Can we have the "soft reload" model like how Django works in development mode? Drop a file on a server, it notices filesystem change, reloads an app (or spawns a second copy of app, waits for it to initialize, kills original app and switches over to a new one)?

Gunicorn has an option for this[1] so you could enable it on your production server, although I don't think that's recommended. One problem with this approach is what happens when you're updating multiple files. If the server restarts immediately on the first change, you end up loading a mix of old and new files, which probably won't work properly. But if you delay the restart to wait for all the files, how long do y…

Assuming you get a new "event" every time a file in the watched folder changes, you could restart the count.

Ex. First even triggers a 5 seconds wait. If before those 5 seconds have passed there is another trigger (say after 1 second) another 5 seconds wait starts, for a total of 6 seconds in this example.

Post reply on HN