News for hackers. Stuff that matters.
Re:HTML Web Components by andai on Monday November 13, 2023 @04:33PM (#38255695)
> lackluster with no "Batteries included"

I wish this weren't so, but it perfectly describes my experience with every single web technology. JavaScript, DOM, Canvas, Web Audio... they all remind me of this quote:

"Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy." -Alan Perlis

Re:HTML Web Components by andai on Monday November 13, 2023 @07:37PM (#38257309)
I am of course, slightly exaggerating, but... by way of analogy:

I used a PDF library that didn't automatically flow text onto the page. You had to do it yourself. Line by line. Page by page. So, I wrote a few routines to do it. Maybe 50 lines? And I'm just like... this PDF library is twenty eight thousand lines lines long... and they couldn't have included those fifty?! Why!

Meanwhile, a browser is 10-20 MILLION lines of code, and ... I originally ranted for several pages, but I'll just go and say that I never want to see the string "undefinedundefinedundefined" show up during runtime (and that this is 100% realistic and achievable in a dynamic language, without type annotations).

Re:HTML Web Components by mewpmewp2 on Monday November 13, 2023 @09:42PM (#38258327)
At least PDF libray you can update to include new functionality under a new version, but you can't just out of blue change the JS behaviour of undefined being rendered. It would definitely break something without warning.
Re:HTML Web Components by andai on Tuesday November 14, 2023 @07:22AM (#38262420)
https://xkcd.com/1172/

No need to break existing software. "use strict" was a great idea. Let's do "use sane"!

Re:HTML Web Components by quickthrower2 on Monday November 13, 2023 @10:26PM (#38258696)
> 100% realistic and achievable in a dynamic language

Achievable by just removing automatic type coercion. Throw errors instead.

Would need to be feature flagged for backwards compatiability.

Re:HTML Web Components by andai on Tuesday November 14, 2023 @07:27AM (#38262472)
Exactly! You put that very elegantly. (I call that proposed flag "use sane")

I always thought JS needed static types to fix the insanity until I tried Python and realized that almost all the insane BS I get in JS are all runtime errors in Python.

There's a very good case to be made for reducing runtime errors, but it's a hell of a good start to at least have them!

Rather than what we have now, which is "assume the programmer is a beginner, who also never makes mistakes", and "given nonsensical commands, just do nonsense, and propagate garbage data throughout the entire program".