[plt-scheme] Trouble with namespace-require

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Apr 18 11:14:36 EDT 2005

[Quoted content reordered slightly...]

At Sun, 17 Apr 2005 04:44:37 +0200, Bertrand Petit wrote:
>     1. Does the method here described to provide independent but
>        "peek-able" evaluation environments sounds same?


> All goes well if the config-env module is attached to the new
> name-space in the context of the code inspector in effect for the body
> of the config-core module. If I create a new code inspector as it was
> just shown, the NAMESPACE-REQUIRE procedure yields the following error
> message that I can't understand: "compile: access from an uncertified
> context to unexported variable from module: #%stxcase in:
> ellipsis-count-error".
> [...]
>     2. What is the meaning of the quoted error message and how to
>        circumvent it?

My guess is that:

 1) Your module is either compiled to .zo form, or it imports modules
    that are compiled to .zo form.

 2) The relevant module contains a macro that uses ellipses in patterns
    and templates.

 3) The expansion of the macro's implementation refers to
    `ellipsis-count-error', which is an unexported function from
    MzScheme's built-in `#%stxcase' module.

 4) The new code inspector is not privileged enough to validate the
    use of `ellipses-count-error' in the compiled code.

I think the solution is to load the "config-env.scm" module (which you
presumably trust) before changing the code inspector.

If you want later code to be able to load libraries, it might be best
to simply disable the use of compiled files by setting the
`use-compiled-file-paths' parameter to null.

Alternately, you could install a load handler that restores the old
inspector while loading trusted .zo files. (In that case, be sure to
set an exception handler, too, so that the untrusted code has no way to
gain control during the dynamic extent of loading the trusted code.)


Posted on the users mailing list.