[plt-scheme] renaming primitives

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Sep 20 10:31:54 EDT 2002

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'.


Posted on the users mailing list.