[plt-scheme] Define-syntax and #hash - ugly compiling behavior

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon Sep 14 15:04:14 EDT 2009

On Mon, Sep 14, 2009 at 4:39 AM, Patrick Steiger <psteiger at dcc.ufba.br> wrote:
> I was told that this happens because the compiler recognizes #hash as a
> hash-table long before (in the lexical analysis?) knowing that it is inside
> a (define-syntax), and therefore doesn't get the semantics of '...' - it
> just interprets it as illegal syntax.
> This seems like a major wart with the language. What are your opinions?

Not really. The model, as I understand it, is that the reader converts
the text of the program into syntax, and macros operate on syntax. In
this case the reader converts #hash into a hash table. This is quite a
simple model, and means that macros are unaffected by the syntax of
the program.

If you want to create a hash table from a macro Jos' solution is one
way to do it.


Posted on the users mailing list.