1 + "five" is an error in PHP, not some random correct-looking value.
1 + "five" is an error in PHP, not some random correct-looking value.
On older ones though, it's not an error: https://onlinephp.io?s=s7EvyCjg5UpNzshXMFTQVlBKyyxLVbIGAA%2C...
Even in the previous major version (7) it's only a warning.
I agree that philosophy is likely the main cause of decisions like this, but JS is hardly unique in having it.
Meaning of course "no errors reported, at any cost".
Programming language language has redefined "error" - to substantial cost to programmers.
It’s a philosophy that might be acceptable for a simple-ish frontend, but when if you try and build something significant it’s just awful.
Source: I inherited responsibility for a > 5m LOC system written in JavaScript. The problems aren’t all JavaScript’s fault, but it does play a major part in it.
+1
A case I'm struggling with recently is Fastmail mail search. Given a valid query which it cannot handle, rather than show an error report, it does its "best" and delivers a false result. With potentially great cost to the unwitting user. Is there even a warning on the doc page?? No.
Forget JavaScript, that's not even an error in Java.
But anyway, it's much less bad in Java because you can force it to err by declaring what type of thing you want it to return.