[plt-scheme] Name clash with mzscheme identifiers

From: Daniel Silva (daniel.silva at gmail.com)
Date: Mon Sep 27 07:23:26 EDT 2004

On Sun, 26 Sep 2004 19:58:48 +0300, Momchil Velikov <velco at fadata.bg> wrote:
> $ cat foo.ss
> (module foo mzscheme
>    (define version "1.0")
>    (provide version)
> )
> $ cat bar.ss
> (require (prefix foo: "foo.ss"))
> $ mzscheme -r bar.ss
> foo.ss:2:2: module: identifier is already imported at: version in:
> (define-values (version) "1.0")
> How can I avoid name clashes with the built-in names ?

You might use a different name internally, then rename your export.

Welcome to MzScheme version 208.1, Copyright (c) 2004 PLT Scheme, Inc.
> version
> (module foo mzscheme
    (define my-version "1.0")
    (provide (rename my-version version)))
> (module bah mzscheme
    (require (prefix foo: foo))
    (printf "foo's version is ~a~n" foo:version))
> (require bah)
foo's version is 1.0

Or you might define a language module that's the builtin mzscheme, but
with version renamed:

> (module mzscheme-renamed-version mzscheme
    (provide (all-from-except mzscheme version)
             (rename version mz-version)))
> (module foo-again mzscheme-renamed-version
    (define version "2.0")
    (provide version))
> (module bah-again mzscheme
    (require (prefix foo: foo-again))
    (printf "this foo's version is ~a~n" foo:version))
> (require bah-again)
this foo's version is 2.0


Posted on the users mailing list.