[plt-scheme] using except-out with prefix-out

From: Doug Orleans (dougorleans at gmail.com)
Date: Mon Apr 14 15:50:38 EDT 2008

I want to make a module that re-exports all the bindings from another
module, but with some of them wrapped.  I tried something like the

  #lang scheme

  (require (except-in "foo.ss" foo))
  (require (prefix-in unwrapped: (only-in "foo.ss" foo)))

  (provide (except-out (all-from-out "foo.ss")
		       (prefix-out unwrapped: foo)))
  (provide foo)

  (define (foo x) (cons 'wrapped (unwrapped:foo x)))

But this produces the following error:

wrap-foo.ss:6:21: except-out: identifier to remove `foo' not included
in nested provide spec at: (all-from-out "foo.ss") in: (except-out
(all-from-out "foo.ss") foo)

If I replace `(prefix-out unwrapped: foo)' with `unwrapped:foo' then
it works fine, i.e. `unwrapped:foo' is not exported.  But I would
rather not have to hardcode the prefix onto `foo'-- the idea is that
there are a bunch of bindings that get wrapped, not just `foo'.  Is
this how prefix-out is supposed to work?  Is there a better way to do
what I want?

--dougorleans at gmail.com

Posted on the users mailing list.