[plt-scheme] renaming primitives

From: Doug Orleans (dougo at ccs.neu.edu)
Date: Fri Nov 1 00:20:23 EST 2002

Matthew Flatt writes:
 > At Wed, 18 Sep 2002 18:12:07 -0400, "Daniel Silva" wrote:
 > > I've run into a slight problem:
 > > 
 > > (module x mzscheme
 > >    (set! gensym (lambda () '123))
 > > 
 > > .... use gensym later...
 > > )
 > > 
 > > I want to make gensym do something else, so I thought it would be fine
 > > to set! it to some new function, but it's built into mzscheme and I
 > > can't mutate module-required variables.  I can't use (require (rename
 > > mzscheme old-gensym gensym)) because I already need to require mzscheme
 > > as the initial-module.
 > > How do I redefine gensym in a module?
 > 
 > You'll have to make a new language that's like MzScheme, except that it
 > doesn't have `gensym':
 > 
 >   (module my-mzscheme mzscheme
 >      (provide (all-from-except mzscheme gensym)))
 > 
 > Then use `my-mzscheme' (or "my-mzscheme.ss', etc.) for x's language
 > instead of `mzscheme'.

I just ran into this problem too, and I used the same solution.
However, is there any particular reason the second argument to
"module" has to be a module-name instead of a require-spec?

--dougo at ccs.neu.edu


Posted on the users mailing list.