[racket] Unexpected symbol in namespace-mapped-symbols

From: Gustavo Massaccesi (gustavo at oma.org.ar)
Date: Fri Dec 20 17:14:30 EST 2013

I'm not sure that this is a bug. I found this while using
define-namespace-anchor.

When I run this program I get an unexpected !!hi.1 symbol in the list
of namespace-mapped-symbols. (All the variable names begin with !! so
they are easy to sort in  the list.)

The variable !!hi is defined inside a macro, so I expect that it
should not be visible from the module namespace. And I can't use
namespace-variable-value to get the value of !!hi.1 .  Also, if I
define a "real" !!hi.1 outside the macro, then there are two !!hi.1
symbols in the list.

Gustavo

;-----
#lang racket

(define-syntax-rule (define-hi)
  (define !!hi #f))

(define-hi)

(define !!tmp #f)
(define !!ns (variable-reference->namespace (#%variable-reference !!tmp)))

(define (symbol<? x y)
  (string<? (symbol->string x) (symbol->string y)))

(take (sort (namespace-mapped-symbols !!ns) symbol<?) 5)
;==> '(!!hi.1 !!ns !!tmp #%app #%datum)

;;;(define !!hi.1 #t)
;-----

Posted on the users mailing list.