define-syntax in typed/racket/base

29 views
Skip to first unread message

Antonio Menezes Leitao

unread,
Oct 3, 2015, 3:59:50 PM10/3/15
to Racket Dev
Hi,

It seems that define-syntax is provided by typed/racket but not by typed/racket/base. Is that on purpose?

The following program compiles in DrRacket, version 6.2.900.17--2015-09-20(6dfc20d/a) [3m]:

#lang typed/racket

(define-syntax (foo stx)
  (syntax-case stx ()
    ((_ expr)
     (syntax/loc stx expr))))

However, if I change the #lang line to

#lang typed/racket/base

I get an error:

syntax-case: unbound identifier in the transformer environment;
 also, no #%app syntax transformer is bound in: syntax-case

BTW, there is no problem with define-syntax-rule.

Best,
Antonio.

Alex Knauth

unread,
Oct 3, 2015, 4:02:38 PM10/3/15
to Antonio Menezes Leitao, Racket Dev

> On Oct 3, 2015, at 3:59 PM, Antonio Menezes Leitao <antonio.men...@ist.utl.pt> wrote:
>
> Hi,
>
> It seems that define-syntax is provided by typed/racket but not by typed/racket/base. Is that on purpose?
>
> The following program compiles in DrRacket, version 6.2.900.17--2015-09-20(6dfc20d/a) [3m]:
>
> #lang typed/racket
>
> (define-syntax (foo stx)
> (syntax-case stx ()
> ((_ expr)
> (syntax/loc stx expr))))
>
> However, if I change the #lang line to
>
> #lang typed/racket/base
>
> I get an error:
>
> syntax-case: unbound identifier in the transformer environment;
> also, no #%app syntax transformer is bound in: syntax-case

For that you should
(require (for-syntax racket/base))

typed/racket provides all of racket/base for-syntax, just like racket does, but
typed/racket/base doesn't, just like racket/base does.

typed/racket/base provides define-syntax in the runtime phase,
but it doesn't provide syntax-case for-syntax.

Antonio Menezes Leitao

unread,
Oct 3, 2015, 4:47:12 PM10/3/15
to Racket Dev
BTW, the same problem occurs with define-sequence-syntax.

Alex Knauth

unread,
Oct 3, 2015, 4:49:07 PM10/3/15
to Antonio Menezes Leitao, Racket Dev
Is the problem still there when you (require (for-syntax racket/base))?

--
You received this message because you are subscribed to the Google Groups "Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+...@googlegroups.com.
To post to this group, send email to racke...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CAJQmiZU2RZGvzvOcVxUTumDOu952WQYaFrRmaVaWSqhoOUdphQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Antonio Menezes Leitao

unread,
Oct 3, 2015, 5:31:06 PM10/3/15
to Alex Knauth, Racket Dev
On Sat, Oct 3, 2015 at 9:49 PM, Alex Knauth <alex...@knauth.org> wrote:
Is the problem still there when you (require (for-syntax racket/base))?


No. I apologize for the noise. I got confused after seeing that my module compiled OK with define-syntax-rule but not with define-syntax.

Thanks for the explanation.

Best,
Antonio.
Reply all
Reply to author
Forward
0 new messages