News for hackers. Stuff that matters.
Re:Don’t Make Me Write HTML by 10ren on Wednesday April 15, 2009 @02:15AM (#563060)
The closing tags of HTML and XML are a nuisance. In SGML (their common predecessor), named closing tags were optional (you used </>), but were deliberately made mandatory in HTML and XML, to improve readability of long documents. It was contentious at the time, and it still is. But we must at least accept the data points that both HTML and XML have been phenomenally successful, without knowing for sure whether this particular feature was for or against.

One thing about dumb, regular, symmetrical formats is that their redundancy makes them less scary and easier to understand. Perhaps, this is accessibility is crucial for adoption.

EDIT I guess indentation enables you to match up start/end tags even better than named close tags... and it's certainly become more familiar to developers since Python's success. But maybe not so good when you have many levels of indentation, and terrible if you want to insert/delete a nested element, because the indentation of the elements within it must also be changed.

Re:Don’t Make Me Write HTML by ubernostrum on Wednesday April 15, 2009 @03:06AM (#563090)
I think you'd be surprised at just what you're allowed to omit in HTML. For example, the following document is valid HTML 4.01 Strict:

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
  <title></title>
  <p>
The 'html', 'head' and 'body' elements -- opening and closing -- are inferred at the correct points by a compliant parser, as is the closing of the lone 'p' element.

Once upon a time on my personal blog, I used minimal HTML 4.01 Strict (omitting tags and other bits of syntax whenever and wherever possible -- I had a Markdown fork that knew how to do this within the constraints of the spec); my one concession was a longer DOCTYPE declaration to deal with anything that didn't know how to resolve the public identifier. Browsers actually handled it just fine, but some other systems (in particular, OpenID autodiscovery) failed, because they weren't actually doing HTML parsing.

Re:Don’t Make Me Write HTML by 10ren on Wednesday April 15, 2009 @03:32AM (#563116)
You're right, I'd forgotten about omitting the closing </p>, but I think that's the only one (omitting a whole element - both open and close - is something different).

Of course, in practice, most HTML parsers will do a wonderful job of interpreting malformed HTML.

Re:Don’t Make Me Write HTML by randallsquared on Wednesday April 15, 2009 @07:21AM (#563291)
It's not the only one. You can omit closing tags for td, tr, th, li, and probably others I don't remember. I actually do this; it doesn't make the resulting document any less clear for humans, and so if I'm typing it myself, there's little point in inserting them.
Re:Don’t Make Me Write HTML by donalm on Wednesday April 15, 2009 @06:23AM (#563248)
The main reason that SGML allowed closing tags to be optional was that it was 80s technology and storage was expensive.

To omit tags you needed a DTD that allowed the parser to infer where the close tags should go.

Enforcing the use of close tags in XML meant that building a parser was much simpler and that you no longer had to supply a DTD which I think were probably very instrumental in XML's success.