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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to