Subject: Re: Lisp syntax, what about resynchronization?
From: Erik Naggum <>
Date: 1999/06/09
Newsgroups: comp.lang.lisp
Message-ID: <>

* Tom Breton <>
| I agree with most of the comments on this thread about Lisp syntax.
| But it occurs to me that one advantage that heterogeneous Algol-type
| syntaxes have over Lisp is that when they get lost, they can detect
| being lost and resynchronize (And thus produce more errors, but that's
| helpful for debugging).  In Lisp, one misplaced parenthesis can easily
| put you into "Where the hell is this problem coming from?" mode.

  that's why we have editors instead of compilers help us find problems.
  one very easy way to spot parenthesis errors is to let Emacs indent the
  whole top-level form.  if something moves, undo the indentation, and fix
  whatever you fairly immediately see caused the problem.  repeat until
  nothing moves.

| (*) Actually, way back when someone here was saying that XML was "Lisp
| with brackets" (which I don't entirely buy, but Lisp syntax for
| markup... yum).  Where resynchronization in a programming language
| just lets you debug more easily, in a markup language it can make all
| the difference between a document that will render and one that won't.

  having been one of the leading SGML experts in the world before I finally
  came to conclude it was a fundamentally braindamaged approach (but a good
  solution once you had taken the wrong approach and stuck with it -- like
  so many serious design errors in programming, or, indeed, politics, where
  it is always harder to get back on track than to continue forward and to
  knock down ever more hindrances -- it's like driving a tank: if you drift
  off the road, any telephone poles you might knock down are only proof
  positive of your mighty tank's ability to get where you want to go, and
  the important psyhological "corrector" that hindrances should have been
  is purposefully ignored because you are too powerful), I could go into a
  long an arduous debate over exactly how little resynchronization ability
  SGML's "labeled parentheses" gives you, and how immensely hard it is to
  backtrack the SGML parsing process.  it's a pity that XML is actually a
  little _worse_ in this regard.

  one of the reasons I got into SGML was that it had beautiful, explicit
  markers of the beginning and end of the syntactic structure.  this I
  sensed was great because I had had a lot of Lisp exposure before SGML.
  however, Lisp's elegance loses all its beauty if you adorn parentheses
  with labels, because you actually _lose_ synchronization ability when you
  have to deal with conflated errors: <BAR>...<BAZ>...</BAR> may close BAZ
  and BAR at the same time in the complex game of omitted end tags in SGML,
  but in the fully explicit case, it may be a typo for </BAZ>, or may be a
  missing </BAZ>.  any attempt to resynchronize will get it right half the
  time, which causes subsequent errors to crop up, and then you'd have to
  go back and try the other possibility, but that means reshuffling your
  entire tree structure.  the same is true of empty elements that are
  mistaken for containers.  perhaps <BAZ> should have been <BAZ/>?  that
  means you get it right only a _third_ of the time in XML where you don't
  even have the DTD to help you decide anything, anymore.  'tis wondrous!

  this is the same problem as the stupid IF THEN ELSE problem created by
  people without functioning brains.  that is, is IF THEN IF THEN ELSE a
  two-branch inner or outer IF?  there's simply no way to tell, so it was
  decided it should be inner, which means the program compiles wrong if the
  compiler's idea is different form the programmer's idea.  in Lisp, a
  missing parenthesis would be found when indenting the code.

  Lisp's simple, unlabeled, explicit-structure-marking syntax solves all of
  these problems.  your silly introduction of syntactic noise is another
  example of how a powerful tool can be used to knock down telephone poles
  instead of taking a hint that you should get back on track.  imagine
  giving the programmer the duty of filling in noise like that!  it's the
  mistakes of SGML all over again: _adding_ stuff to make it simpler.

  I hate it when history repeats itself and nodoby learned anything last
  time, either: those who do not know Lisp are doomed to reimplement it.

@1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century