Thanks for the suggestion, Jos _____
From: Alexander D. Knauth [mailto:[email protected]] Sent: jueves, 06 de agosto de 2015 16:55 To: Jos Koot Cc: Racket-Users List Subject: Re: [racket-users] Distinct instantiations of modules I think namespace-attach-module is one way to do this: #lang racket (module a racket (define ns (make-base-namespace)) (namespace-attach-module (current-namespace) 'racket/promise ns) (parameterize ((current-namespace ns)) (namespace-require 'racket)) (define *promise? (namespace-variable-value 'promise? #t #f ns)) (*promise? (lazy 1))) (require 'a) ; #t On Aug 1, 2015, at 8:03 PM, Jos Koot <[email protected]> wrote: Some (I think many) modules define struct types and provide the constructors and predicates of these structs. A predicate of an instance of such a module does not recognize a struct made by a distinct instance of the same module. For example: #lang racket (module a racket (define ns (make-base-namespace)) (parameterize ((current-namespace ns)) (namespace-require 'racket)) (define *promise? (namespace-variable-value 'promise? #t #f ns)) (*promise? (lazy 1))) (require 'a) ; -> #f where I would want #t I know there is a solution for this problem: #lang racket (module b racket (define-namespace-anchor id) (define ns (namespace-anchor->namespace id)) (void (parameterize ((current-namespace ns)) (namespace-anchor->namespace id))) (define *promise? (namespace-variable-value 'promise? #t #f ns)) (*promise? (lazy 1))) (require 'b) ; -> #t as wanted Nevertheless, is there any chance to modify things such that once a module has been instantiated, each new require of that module gives the same instantiation? May be there are reasons not to do so, but I do not know why not. Your opinion would be much appreciated. Thanks, Jos Koot -- 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 [email protected]. 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

