News for hackers. Stuff that matters.
Re:Abuse of the nullish coalescing operator in JS/TS by polishdude20 on Thursday November 27, 2025 @01:41PM (#46072043)
Exactly, something like a name missing shouldn't cause the app to completely error out for the user.
Re:Abuse of the nullish coalescing operator in JS/TS by slooonz on Thursday November 27, 2025 @01:47PM (#46072096)
Yes it should, because hopefully errors are logged and reported and can be acted upon. Missing name doesn’t.
Re:Abuse of the nullish coalescing operator in JS/TS by pitched on Thursday November 27, 2025 @01:54PM (#46072162)
If the error isn’t repairable by the user, blocking them from using the app entirely is mean. If the error screen has a message telling the user where to go to set their name, that’s fine but annoying. If the error screen tells the user they can’t use the app until someone checks a dashboard and sees a large enough increase in errors to investigate, that’s a bigger problem.
Re:Abuse of the nullish coalescing operator in JS/TS by jackblemming on Thursday November 27, 2025 @01:56PM (#46072190)
This reads like a dogmatic view of someone who hasn’t worked on a project that’s a million plus lines of code where something is always going wrong, and crashing the entire program when that’s the case is simply unacceptable.
Re:Abuse of the nullish coalescing operator in JS/TS by mystifyingpoi on Thursday November 27, 2025 @02:36PM (#46072536)
> something is always going wrong

I hate this sentence with a passion, yet it is so so true. Especially in distributed systems, gotta live with it.

Re:Abuse of the nullish coalescing operator in JS/TS by noman-land on Thursday November 27, 2025 @01:49PM (#46072111)
Why not both?
Re:Abuse of the nullish coalescing operator in JS/TS by rustc on Thursday November 27, 2025 @01:56PM (#46072189)
That's how you get this feature: https://wiki.php.net/rfc/deprecate-bareword-strings.

tldr: undefined constants were treated as a string (+ a warning), so `$x = FOO` was `$x = "FOO"` + a warning if `FOO` was not a defined constant. Thankfully this feature was removed in PHP 8.