[plt-scheme] Redefining function from scheme/base

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Jun 12 04:43:21 EDT 2008

On Thu, Jun 12, 2008 at 7:41 AM, Chongkai Zhu <czhu at cs.utah.edu> wrote:
> If your answer to the first question is yes, then the old trick is to make
> you own language (as a module) that exports your 'real->decimal-string' and
> everything else from scheme. Then you can base you  other modules on your
> own language instead of scheme/base.

You can do this without defining a new language, which I believe is
preferable.  Clients will have to import that identifier with a prefix
to avoid name collisions (as is done, for example, with SRFI-1).
Untested example code:

defining module:

#lang scheme/base

(define (my-real->decimal-string ...) ...)

(provide (rename-out my-real->decimal-string real->decimal-string))


client module:

#lang scheme/base

(require (prefix-in s: defining-module))

;; use
(s:real->decimal-string ...)


Posted on the users mailing list.