#| Consider: |# #lang racket (define (get-from-fresh-namespace var) (let ((namespace (make-base-empty-namespace))) (parameterize ((current-namespace namespace)) (namespace-require 'racket) (namespace-variable-value var #t (λ () 'error))))) (eq? (get-from-fresh-namespace 'add1) (get-from-fresh-namespace 'add1)) ; -> #t (eq? (get-from-fresh-namespace 'force) (get-from-fresh-namespace 'force)) ; -> #f #| It is clear to me why the last form produces #f. Procedure force is a predicate of a struct and is exported by module .../collects/racket/promise.rkt. For each fresh empty base-namespace the form (namespace-require 'racket) uses a distinct instance of this module. Each instance defines the promise-struct freshly and provides distinct variable- and syntax-bindings related to promises. Is my observation correct? It is little bit confusing that procedure get-from-fresh-namespace, when called with the same variable-name, in some cases returns identical values and in others does not. I think it is not easy to make Racket such as to make it procedure get-from-fresh-namespace always to return distinct objects (not eq?) or always to return identical objects (eq?) when called with the same variable-name. I know, I am comparing procedures, but as |# (let ((a add1)) (eq? a add1)) #| is guaranteed to return #t, I wonder what you folks think about to make modules such as always provide the same instance of a module when required within the same Racket or DrRacket session. Is it possible? Is it desirable? What when a module produces side effects (e.g. displayed output)? |#
____________________ Racket Users list: http://lists.racket-lang.org/users

