[plt-scheme] eval and modules

From: Kirill Lisovsky (lisovsky at acm.org)
Date: Wed Aug 7 18:52:50 EDT 2002

Hello!

Compiling an 'eval'-intensive Scheme code to standalone executable with 
PLT Scheme ver. 200 I've encountered a problem:

It looks that:
 1. "modularization" makes top-level bindings unavailable in 'eval'
 2. 'mzc --exe' requires a "modularized" source code 
("Embed module in MzScheme to create <exe>")

A distilled example:

(define x "ok")
(display (eval 'x))
(exit)

may be interpreted successfully (with 'mzscheme -r' or any other 
Scheme interpreter), but it can't be compiled with 'mzc --exe ...':
 >  read-one: expected a module declaration, found: (define x "ok")

OTH, for:

#cs(module a mzscheme
(define x "ok")
(display (eval 'x)) 
(exit))

both 'mzscheme -r' and executable compiled with 'mzc --exe ...' encounter
an error:
  > reference to undefined identifier: x

So, the question is: how to compile (with "mzc --exe") a code
where top-level bindings has to be visible in 'eval'?


Auxiliary question: for 'mzscheme -r' it was necessary to add 

(require a)

in order to run the latter example above.
Is it the proper way to interpret a module using command-line mzscheme? 

Best regards,
         Kirill.





Posted on the users mailing list.