[racket] Fwd: Rationale behind missing string-trim
[forwarding to racket-users]
---------- Forwarded message ----------
From: Chad Albers <calbers at neomantic.com>
Date: Wed, May 9, 2012 at 2:22 PM
Subject: Re: [racket] Rationale behind missing string-trim
To: Danny Yoo <dyoo at hashcollision.org>
Happy to help you guys identify a bug. On a side note, that's not
really relevant to this thread, I was wondering about your statement
about #lang racket.
I had assume that you just add #lang racket, if you're writing a
racket script, sort of like the hash bang syntax of a shell script.
Is that a correct assumption? Related, the code I'm writing is
actually in a module I'm creating, and I've used this to source the
racket language:
(module rig racket
(require racket/base
(for-syntax racket/base
racket/syntax))
Should I have used #lang racket? is racket/base redundant, since I
have it in the module definition? Thanks for your help, if you can
answer these questions for me.
Chad
--
Chad Albers
On Wed, May 9, 2012 at 1:45 PM, Danny Yoo <dyoo at hashcollision.org> wrote:
>
> 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)