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

2014-07-25 Thread Matthew Flatt
I'll push a repair.

The problem is in the representation of syntax objects and the flaky
way that it was generalized to support identifiers that move across
submodule boundaries (but the problem didn't just affect programs with
submodules, in this case).

At Thu, 24 Jul 2014 16:24:42 -0400, Sam Tobin-Hochstadt wrote:
 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))
   (def-wrap))
 
 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.
 
 Sam
 
 On Thu, Jul 24, 2014 at 4:08 PM, Sam Tobin-Hochstadt
 sa...@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
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


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

2014-07-24 Thread Sam Tobin-Hochstadt
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
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


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

2014-07-24 Thread Sam Tobin-Hochstadt
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))
  (def-wrap))

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.

Sam

On Thu, Jul 24, 2014 at 4:08 PM, Sam Tobin-Hochstadt
sa...@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
_
  Racket Developers list:
  http://lists.racket-lang.org/dev