[plt-dev] #hash vs. #s

From: Dave Herman (dherman at ccs.neu.edu)
Date: Fri Feb 6 14:10:54 EST 2009

> 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.

Dave


Posted on the dev mailing list.