[plt-scheme] Evaluation Across Modules (or Namespaces?)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jul 16 13:35:08 EDT 2006

At Sun, 16 Jul 2006 10:12:23 -0700, "Williams, M. Douglas" wrote:
> And get this when I run it:
> 
> (app(t1 2) = 4
> (my-f2 2) = 4
> . . a.ss::436: reference to undefined identifier: my-f2
> 
> So, it seems to only work for identifiers (like *) in the mzscheme
> namespace.

I don't think I understand your whole problem, but you might make
progress by using syntax objects instead of plain symbols and pairs:

(module a mzscheme
  
  (provide (all-defined))
  
  (define-struct s (args body f))
  
  (define-syntax def
    (syntax-rules ()
      ((d name args body ...)
       (define name (make-s #'args
                            #'(body ...)
                            #f)))))
  
  (define (act an-s)
    (set-s-f! an-s
              (eval #`(lambda #,(s-args an-s)
                       #,@(s-body an-s)))))
  
  (define (app an-s . args)
    (apply (s-f an-s) args))
  
  (define (my-f3 x) (* x x))
  
  )


Matthew





Posted on the users mailing list.