[racket-dev] strange top-level binding for module-defined identifiers

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Thu Jul 24 16:24:42 EDT 2014

Ok, here's a much simpler example:

#lang racket

(module foo racket
  (provide def-wrap)
  (define-syntax-rule (def-wrap)
    (begin  (define y 1) y)))

(module bar racket
  (require (submod ".." foo))

In the fully-expanded syntax, the macro stepper suggests that `y` has
no apparent binding.

At this point it seems unlikely that it's a bug, since it happens all
the time, but I still don't understand.


On Thu, Jul 24, 2014 at 4:08 PM, Sam Tobin-Hochstadt
<samth at cs.indiana.edu> wrote:
> If you take this program (which is a lot like the implementation of
> `racket/fixnum`):
> #lang racket/base
> (require '#%flfxnum
>          racket/private/vector-wraps
>          racket/unsafe/ops
>          (for-syntax racket/base))
> (define-vector-wraps "fxvector"
>   "fixnum?" fixnum?
>   fxvector? fxvector-length fxvector-ref fxvector-set! make-fxvector
>   unsafe-fxvector-ref unsafe-fxvector-set! unsafe-fxvector-length
>   in-fxvector*
>   in-fxvector
>   for/fxvector
>   for*/fxvector
>   fxvector-copy
>   0)
> And run it in the macro stepper with macro hiding off, at the end you
> get a fully-expanded module where the first definition is
> `:fXvector-gen`. However, if you click on this identifier, either in
> the definition or in a subsequent use, it says "Apparent identifier
> binding: none" (which means that `identifier-binding` returns #f,
> which can be confirmed on the expanded syntax).
> How can this happen? Is it a bug in something, or a special case that
> I didn't expect?
> Sam

Posted on the dev mailing list.