[racket-dev] P4P: A Syntax Proposal

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Jul 31 20:37:58 EDT 2010

On Jul 31, Guillaume Marceau wrote:
> I've never seen student in a beginner course work this way. As an
> experiment, I invite you to try programming without using tab, and
> without deleting blocks of parenthesis at once. I suspect you will
> develop sympathy for these students who "hate parentheses".

I have no idea what kind of crowd I'd be a representative of, but --
(a) I use tab *very* rarely (only when modifying some big chunk of
code so the nesting level changes, and in less than 25% of these
cases); (b) I practically never remove parens and leave an unbalanced

> Why would this be less of a problem in curly brace languages?
> First, there are just many more parentheses in a Racket program. As
> Matthias was saying, we use a lot of nested expressions, and
> function call dictate nearly everything. So, in a curly brace
> language, when a student is trying to re-infer their parenthesis
> structure, there are fewer of them, so it isn't as hard.
> Second, the grammar markers in a curly brace language have names on
> them. They use "then" to separate the predicate from the answer, we
> use ")(". It is much easier to re-infer intentionality of the
> former.  The latter is just another a bunch of parenthesis floating
> amongst other anonymous parentheses.


All this sounds questionable to me.  IMO, the main paren-related
difference between a racket program and a C program, is that nested
function calls are more common in the first than in the second,

    int foo(int x) { return x; }
    (define (foo x) x)

have the same number of parens.  Also, modern curely brace languages
almost never use `then' and we don't use ")(" -- so at least for the
predicate <--> true branch you have whitespace in both cases; other
special forms in curely braces are usually not using keywords beyond
the openning one.  ("Anonymous parentheses" reminds me of the pascal
days where the language was much more keyword-full, yet it was common
to decorate an "end" with a comment saying what it ends.)


          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.