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

From: Williams, M. Douglas (M.DOUGLAS.WILLIAMS at saic.com)
Date: Sun Jul 16 13:45:30 EDT 2006

Thanks, that works for the example.  I got my inference engine working
initially without developing the macros to implement the rules language - I
just build the rule definition structures directly.  I am now implementing
the rules language and that's where I am having the problem.  There is quite
a bit of manipulation I do with the rule elements that might be affected by
using syntax objects instead of plain symbols and pairs, but I'll take a
stab at it.

I think you've pointed me in the right direction anyway.


-----Original Message-----
From: Matthew Flatt [mailto:mflatt at cs.utah.edu]
Sent: Sun 7/16/2006 11:35 AM
To: Williams, M. Douglas
Cc: plt-scheme at list.cs.brown.edu
Subject: Re: [plt-scheme] Evaluation Across Modules (or Namespaces?)
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 ...)
  (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))


Posted on the users mailing list.