[racket] Rationale behind missing string-trim

From: Danny Yoo (dyoo at hashcollision.org)
Date: Wed May 9 13:45:15 EDT 2012

On Wed, May 9, 2012 at 1:23 PM, Chad Albers <calbers at neomantic.com> wrote:
> If my require reads as follows
>
> (require racket/base
>            srfi/13
>        (for-syntax racket/base
>                racket/syntax))
>
> I get the following error message:
>
> module: identifier already imported from: racket at: string-upcase in:
> srfi/13
>


Huh!  That looks like the error reporting is misattributing the source
of the conflict.  I'll send a bug report.

The error is highlighting the "racket" in the #lang line and srfi/13,
but the true source of the conflict's really between the exports of
racket/base and srfi/13.  For demonstration, try:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#lang racket
(require (only-in racket/base string-upcase)
         srfi/13)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

vs:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#lang racket
(require (only-in racket/base)
         srfi/13)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In the first,  we tell Racket o use both the string-upcase function in
racket/base, as well as all the exports of srfi/13.  Since both
requires provide a string-upcase function, there's a conflict, which
the DrRacket environment reports.

In the second, we mask out all the exports from racket/base.  So the
exports of srfi/13 can otherwise shadow everything else without
complaint.



Side note: the big language of "#lang racket" provides everything in
racket/base, so the (require racket/base) is actually redundant.  You
can write:

     #lang racket
     (require srfi/13)


Posted on the users mailing list.