The `make-base-namespace` function creates a new namespace, but it
attaches the `racket/base` instance of the current namespace to the new
one. The `error-print-width` parameter comes from `racket/base`, so
it's still the same parameter.

You can use `namespace-attach-module` to attach "param.rkt" to the new
namespace, too, if you want its instance and parameter to be shared
across the namespaces.

At Sun, 30 Aug 2015 12:04:30 -0700, Matthew Butterick wrote:
> In the example below, I'm curious about the reason for the difference between 
> the behavior of the system parameter `error-print-width` and the custom 
> parameter `my-param`. 
> 
> I understand why `my-param` doesn't take the parameterized value 'custom (= 
> because `namespace-require` causes a fresh instantiation of "param.rkt" in 
> the 
> new namespace, which binds `my-param` with its default value). 
> 
> But if that's the case, then why does `error-print-width` accept the 
> parameterized value? Why doesn't it get instantiated at its default value of 
> 250 when the new namespace is made?
> 
> 
> ;; param.rkt
> #lang racket
> (provide my-param)
> (define my-param (make-parameter 'default))
> 
> 
> ;; param-test.rkt
> #lang racket
> (require "param.rkt")
> (parameterize ([current-namespace (make-base-namespace)]
>                [error-print-width 4242]
>                [my-param 'custom])
>   (namespace-require "param.rkt")
>   (namespace-require 'rackunit)
>   (eval '(begin (check-equal? (error-print-width) 4242) ;; not 250
>                 (check-equal? (my-param) 'default)))) 
> 
> -- 
> 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.

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