[plt-dev] #hash vs. #s

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Feb 6 17:32:28 EST 2009

At Fri, 06 Feb 2009 14:10:54 -0500, Dave Herman wrote:
> > Unquote for the value part of a `#hash' could work. I'm less sure that
> > it's a good idea for the key position, since the reader constructs a
> > hash table.
> Good point. For example:
>      (define table
>        `#hash((,(read) . foo)
>               (,(read) . bar)
>               (,(read) . baz)))
> The reader constructs a hash with a single entry whose key is the 
> S-expression (unquote (read)), and it's too late for `qq' to reconstruct 
> the source.
> > Aside from the possible constraint on keys, it's not so much a reader
> > issue as a question of what the `quasiquote' macro recognizes. The
> > source of `quasiquote' is "collects/scheme/qq-and-or.ss".
> I've mostly implemented this on my machine. I can submit a patch, but 
> which behavior do you prefer?
> 1) qq leaves the key position quoted and interprets the value position.
> 2) qq errors on any occurrence of `unquote' in a key position.
> 3) scrap this whole extension and leave `qq' as is.

I like 2. It seems like a sensible and useful extension. The change
could potentially break some old code, but that seems unlikely.

Posted on the dev mailing list.