[plt-scheme] Sandboxing and modules

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Feb 7 13:27:46 EST 2004

At Sat, 7 Feb 2004 12:24:46 +0200 (EET), Markku Rontu wrote:
> (module less-safe-scheme mzscheme
> 	; provide all in safe-scheme
> 	(require safe-scheme)
> 	(provide (all-from safe-scheme))
> 	; provide some more
> 	(provide read-eval-print-loop ...)
> )
> 
> ---
> 
> The problem is, that does not compute. I cannot (require safe-scheme) because
> of duplicate names between it and mzscheme.

There should be a better way to do this, but here's one idea...

Have a macro expansion introduce the names, and have the same expansion
export them. Since the expansion introduces the names, they won't bind
in the rest of the module (and therefore won't conflict with other
imports).

  (define-syntax provide-safe-scheme
    (syntax-rules ()
      [(_)
       (begin
	 (require safe-scheme)
	 (provide (all-from safe-scheme)))]))

  (provide-safe-scheme)


Matthew



Posted on the users mailing list.