[racket-dev] P4P: A Syntax Proposal

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Wed Jul 28 18:14:37 EDT 2010

> I believe the idea was not to convert people who like s-exprs but rather
> to attract all those other programmers (including beginners) who don't
> like them.   (It might also help convince older CS dept people to allow
> changing the intro CS course to H2DP using a non-parenthesis syntax.)

Precisely!  Couldn't have put it better -- thanks.

> I don't understand why not write a lexer, since replacing "do: ()" with
> "{}" is the most natural and readable thing to do.

I really don't want to touch the lexer level.

Until this morning, I didn't know how to check for { ... }, which is
why I had the do: keyword.  It appears that I can get rid of it.  I
have to decide now whether I want to.  I'll think about that.

>  It also would allow
> "when:" to expect one argument by default since "when: {}" is easy to
> write.

That would be fine.  I'll think about that, too.

> Infix notation can be achieved unambiguously if you use LL(1) with
> backtracking

...which I didn't want to do.

Pedagogically, it has been immensely valuable to explain to kids that
+ and - aren't some special thing, but are just mere operators -- and
so are string-append and image-overlay and so on.

Plus, there isn't much arithmetic in many Scheme programs, which means
the quantity of actual infix is small.

> Did the proposal address how quoting/unquoting could be done on P4P
> syntax (for macros, etc.), or how to make a list?   I suppose "list(a, b,
> c)" would work, but do we not have "'(a, b, c)" or something too?

I had some trouble getting quote to work.  It seems like it should not
be a problem.  But it's on my list.  I haven't thought about
unquoting, though it should be possible in principle.  (It's always
been on the todo list at the top of the implementation file.)

Shriram


Posted on the dev mailing list.