I
​ have a minimal example that reproduces the behavior and I can track it
down to the fact that I do not export "define" and the file which uses the
new #lang does not define anything, except through a #%module-begin
rewrite. If the file written in the new #lang has access to define and
defines anything, then indeed it shows up. Please forgive any gmail
formatting:

TEST/
--test.rkt​
--test-lang/
----test-lang.rkt
----lang/
------reader.rkt

I add the TEST directory to PLTCOLLECTS.

reader.rkt:
#lang s-exp syntax/module-reader
"test-lang/test-lang.rkt"

test-lang.rkt:
#lang racket/base
(provide (rename-out (my-module-begin #%module-begin))
         #%app #%top #%datum #%top-interaction
         require displayln)

(define-syntax-rule (my-module-begin body ...)
  (#%module-begin
   (define x 2)
   (provide x)
   body ...))

test.rkt:
#lang test-lang
(displayln 2)

Run "test.rkt"
Welcome to DrRacket, version 6.2 [3m].
Language: test-lang [custom]; memory limit: 4096 MB.
2
> x
. . x: undefined;
 cannot reference an identifier before its definition
> (require "test.rkt")
> x
2
​;;;;;;;;;;;;;;;;;;;;;

It seems to be because of the definition of x in my-module-begin. But I
don't understand why this doesn't work.

Thanks for any insight here, I seem to have a bad mental model of what's
happening,
Deren​


On Fri, Aug 7, 2015 at 4:32 PM, Alexander D. Knauth <alexan...@knauth.org>
wrote:

> That sounds weird. You shouldn't need to do anything special with
> #%top-interaction or anything, so I'm not sure what's going on.
>
> How are you defining it?  Can you show us some of the source code?
>
> On Aug 7, 2015, at 1:09 PM, Deren Dohoda <deren.doh...@gmail.com> wrote:
>
> > I have a #lang I'm working on and everything seems to be going very
> well. One thing I don't understand, though, is that when a file written in
> this language is opened in DrRacket and Run, I still have to (require
> "file.rkt") in the REPL before I am able to use anything provided by the
> file.
> >
> > I assume that I am neglecting to do something somewhere related to the
> use of #%top-interaction, because when I fail to provide this from the
> implementation of the language, I cannot run the file in DrRacket at all.
> But merely adding it to the provide expression doesn't do what I expect.
> >
> > Any help?
> >
> > Deren
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to