> On Jul 14, 2016, at 5:11 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
> 
> At Thu, 14 Jul 2016 16:01:52 -0400, Alex Knauth wrote:
>> Ok, by using `syntax-debug-info` I was able to get somewhere. However, I 
>> want 
>> to make the variables I'm putting into the namespace all immutable. For that 
>> I 
>> thought I could use `define-syntax` within `eval`, but `define-syntax` 
>> appears 
>> to not have any effect:
>> 
>> #lang racket/base
>> (require (for-syntax racket/base))
>> (define-namespace-anchor a)
>> (define ns (namespace-anchor->namespace a))
>> (eval '(define-syntax x (λ (stx) #'333)) ns)
>> ;; This wasn't an error ... did it work?
>> (eval 'x ns)
>> ;. x: undefined;
>> ; cannot reference an identifier before its definition
>> ;; Nope.
>> 
>> What's going on? Why isn't `(eval '(define-syntax ....))` having any effect?
> 
> I've pushed a repair. It's was a bug in `namespace-anchor->namespace`,
> which neglected to set a "namespace has become hopeless" bit on the
> namespace that it returns.

Oh ok. So if the namespace isn't hopeless, then it knows it doesn't need to 
preserve transformer bindings, but if it's hopeless it needs to keep everything 
in case it needs it? Anyway, thanks!

I've noticed that if it can refer to a module-level immutable variable, `eval` 
seems to know that it's immutable. So is there any way to define a new variable 
as immutable in a namespace?

Alex Knauth

-- 
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