[racket] confusing error message: what is "lang:read.1"?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 8 01:23:10 EDT 2014

At Wed, 6 Aug 2014 15:50:41 -0700, Matthew Butterick wrote:
> Under certain circumstances, because of what I assume is a bug in my code, I 
> get an error like this:
> 
> > define-values: assignment disallowed;
> >  cannot re-define a constant
> >   constant: lang:read.1
> >   in module: "/Users/mb/git/racket/racket/collects/racket/main.rkt"
> >   context...:
> >    (submod /Users/mb/git/racket/racket/collects/racket/main.rkt reader): 
> [running body]
> 
> I understand how the "assignment disallowed" error arises. What I don't 
> understand is the meaning of "lang:read.1" in this context. I'm guessing it has 
> something to do with the #lang line (?) but ... the rest is hazy. 

The "lang:read" part is the name of a variable that appears in the
macro expansion of the `racket` module's `reader` submodule. The ".1"
part is because that variable is macro-introduced so that it is not
directly accessible using the name `lang:read`.

The way that `dynamic-rerequire` and submodules interact here is
unsatisfying. I think it's a collision between the way that
`dynamic-rerequire` pulls from source and the use of
`namespace-module-attach` within `make-base-namspace`, and I think that
`dynamic-rerequire` needs to do something different, but I haven't yet
sorted it out.


Posted on the users mailing list.