[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NOISE] Curly braces [was Re: Curl]



   From: Shriram Krishnamurthi <sk@cs.brown.edu>
   Vladimir G Ivanovic wrote:
   > I'd like to second Dan's observation. Although I believe that Forth, ML,
   > and Lisp/Scheme are "better" languages from a theoretical point of
   > view,[1] I also believe that one of the reasons for Java's popularity is
   > that it more closely matches the imperative way we actually behave: we
   > perform actions on objects for their side effects, e.g. toasting a
   > bagel. (Recall that one of Gosling's previous creations was NeWS, a
   > PostScript-like display system, so he was no stranger to postfix
   > notation.)

   I think you're confusing two totally unrelated things: syntax and
   semantics.  Postfix syntax has nothing to do with whether or not a
   language supports imperative programming.  Furthermore, you can write
   totally imperative programs in both Scheme and ML.  Granted, the
   Scheme syntax is stupid and annoying, but ML's is not -- it's as free
   of parentheses as Java's is.  The assignment operator is a simple
   infix :=.

And yet... ML's syntax *is* annoying. It's a real pain to indent well, not
only by emacs mode, but even when choosing a good layout by hand. Experienced
ML programmers complain about this. The problems emacs has parsing ML, and ML
fragments, mean that moving around code buffers, or selecting syntactic chunks
of code, is not very good. This is also quite annoying. The token "=" is
used in about three different syntactic contexts; urk.

I find paren-haters are always people that haven't done much or any
programming in Scheme or Lisp. Once you've done it, you see the power
and beauty of the s-expression syntax framework. GLS described this
journey in an earlier msg, when he talked about Lisp programmers who,
as beginners, implement and then subsequently abandon, infix syntaxes.
It's not just an oversight that Lisp syntax is the way it is!

Kent Pitman has a nice discussion of s-expression syntax on slashdot today --
he did a Q&A interview, and this was the very first question!

Here's my bottom line on s-exp syntax: the things people don't like about it,
i.e., all those parents, are really, really surface issues. Surface issues
vanish perceptually after you acclimate. Schemers are puzzled by the
complaints because *we don't even see the parens* about which people complain.
On the other hand, the things that are *good* about the s-exp syntax, persist:
  - Easy for program-development environments to understand and manipulate
  - Straightforward to layout on the page
  - New, defined operators given equal treatment to base operators, i.e.,
    the built-in integer-multiply function is used in the same manner (* ...) 
    as the matrix-multiply function (matrix* ...) I write. This is especially
    important in a language where procedures are first-class.
and, for me, the primo, numero uno, big, major win:
  - Easy to syntactically extend, i.e., with the new little language
    you just dreamed up for your particular problem domain.

S-expression syntax rocks. If it looks ugly to you, then, to me, that just
means you haven't yet had the full experience.
    -Olin