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

From: Patrick Steiger (psteiger at dcc.ufba.br)
Date: Sun Sep 13 23:39:00 EDT 2009

Hello, all. This is my first post on the list, I'm a CS student and I've
been giving Scheme a shot. (liking it a lot, so far).

Now, given the following code:

(define-syntax myhash
  (syntax-rules (->)
    [(_ (x -> y) ...)
     #hash((x . y) ...)]))

When trying to compile it, I get:

. read: expected `(' or `[' or `{' to start a hash pair

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?

-- 
Patrick Steiger.

"Theory is when you know something, but it doesn't work. Practice is
when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't
know why." - Anon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090914/647ea27f/attachment.html>

Posted on the users mailing list.