[plt-scheme] Delimiting tokens

From: Lauri Alanko (la at iki.fi)
Date: Mon Jan 30 15:39:26 EST 2006

On Mon, Jan 30, 2006 at 03:19:08PM -0500, Eli Barzilay wrote:
> * Use something like ~{xxx} as an alternative syntax for ~xxx -- this
>   way you can add that when needed.  (Same idea as shell variables.)

This attacks my sense of simplicity and consistency. There is one
concept here: an s-expression escape. There should be one syntax for it.

> * When you're in the nested reader, parameterize the recursive `read'
>   by a syntax table that makes some additional characters terminate
>   identifiers.

The problem with this is that then I cannot really include arbitrary
scheme code in the escape. Effectively the language that can be used
there is a subtly limited dialect of "ordinary" mzscheme code. That
seems like begging for trouble.

> It's ugly enough that it's not worth it (IMO, of course) to confuse
> people, 

This is of course purely a matter of taste, and opinions vary widely. To
quote Will Clinger:

| I and several other implementors feel that it is in the spirit of
| Scheme to allow zero or more things in front of the dot, instead of
| the official one or more things.

And I agree with him on this (though it took me a while to do so).

> and providing a parameter that defaults to #f seems like it wouldn't
> be that much helpful since it's very easy to change the "("-reader
> yourself...

Yes, of course I can solve this problem in any number of ways by myself. 
As can you. The point is that since this is a common problem it's better
to have a standard way of doing it rather than different ad-hoc
solutions everywhere. Being able to make anything self-delimited is a
fundamental lexical feature that IMO definitely belongs to the core
reader. The actual surface syntax for it is less essential, but
dot-initial lists are to my mind the most lightweight and consistent

Frankly, I can't see why (. x) could ever be uglier than (x . y . z). :)


Posted on the users mailing list.