[plt-scheme] mzc, eval and redefined structures

From: Orlando Hill (orlandodarhill at gmail.com)
Date: Sat Jan 5 01:18:08 EST 2008

I have some code that I generate and eval at runtime.

The generated code accesses a library that is also used in other parts 
of my program.

Currently, this works fine with mzscheme but not with a stand-alone mzc 
version. The problem encountered is that structures of the shared 
library seem to be redefined in the mzc version.

I've tried doing a few things with name-spaces but I feel like I'm 
stabbing in the dark.

Below is a tested simplification of the current code.
'mzscheme -mv -t app.scm' gives #t.
'mzc --exe app app.scm && ./app' gives #f.

Hope you can help,
Orlando.

--- File: app-lib.scm ---
(module
app-lib
mzscheme

(provide (all-defined))
(define-struct app-lib (data))
)

--- File: app.scm ---
(module
app
mzscheme

(require "app-lib.scm")

(define code "(module app-code mzscheme (require \"app-lib.scm\") 
(provide app-code) (define (app-code data) (make-app-lib data)))")

(define (run)
  (eval (read (open-input-string code)))
  (let ((data ((dynamic-require 'app-code 'app-code) "data")))
    (display (app-lib? data))
    (newline)))

(run)
)



Posted on the users mailing list.