Comment by eterm
1 day ago
> Would it kill people to have to close their tags properly
It would kill the approachability of the language.
One of the joys of learning HTML when it tended to be hand-written was that if you made a mistake, you'd still see something just with distorted output.
That was a lot more approachable for a lot of people who were put off "real" programming languages because they were overwhelmed by terrible error messages any time they missed a bracket or misspelled something.
If you've learned to program in the last decade or two, you might not even realise just how bad compiler errors tended to be in most languages.
The kind of thing where you could miss a bracket on line 47 but end up with a compiler error complaining about something 20 lines away.
Rust ( in particular ) got everyone to bring up their game with respect to meaningful compiler errors.
But in the days of XHTML? Error messages were arcane, you had to dive in to see what the problem actually was.
If you forget a closing quote on an attribute in html, all content until next quote is ignored and not rendered - even if it is the rest of the page. I dont think this is more helpful than an error message. It was just simpler to implement.
Let's say you forget to close a <b></b> element.
What happens?
Even today, after years of better error messages, the strict validator at https://validator.w3.org/check says:
What is line 22?
It's up to you to go hunting back through the document, to find the un-closed 'b' tag.
Back in the day, the error messages were even more misleading than this, often talking about "Extra content at end of document" or similar.
Compare that to the very visual feedback of putting this exact document into a browser.
You get more bold text than you were expecting, the bold just runs into the next text.
That's a world of difference, especially for people who prefer visual feedback to reading and understanding errors in text form.
Try it for yourself, save this document to a .html file and put it through the XHTML validator.
You can have catastrophic parsing errors with the “lax” HTML too. For instance:
Or:
For reference, observe what happens if you try opening this malformed document in a browser: save it with a .xhtml extension, or serve it with MIME type application/xhtml+xml.
Firefox displays naught but the error:
Chromium displays this banner on top of the document up to the error:
2 replies →
I can "handwrite" C, Python, etc. just fine and they don't assign fallback meanings to syntax errors.
> Rust ( in particular ) got everyone to bring up their game with respect to meaningful compiler errors.
This was also part of the initial draw of `clang`.