why parens aren’t like html

I’m currently taking the programming languages course on Coursera.  The instructor defends the parens LISP/Scheme/Racket by saying HTML takes the same approach but longer:

  • (foo maps to <foo>
  • ) maps to </foo>

And that people don’t complain about HTML.  The problem isn’t the number of characters though.  It’s the clarity. </foo> gives you context.  I think a better example would be:

<div id="one"><div id="two"><div id="three"></div></div></div>

Quick – which div is which?  I do agree with the instructor that indenting properly avoids this problem.  And that editors can tell you what the parens go with.

I’ll end with the cartoon he mentions in the lecture:  (http://imgs.xkcd.com/comics/lisp_cycles.png)

Leave a Reply

Your email address will not be published.