[plt-scheme] Requiring SRFIs

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jul 1 16:23:18 EDT 2008

On Jul  1, Richard Cobbe wrote:
> On Tue, Jul 01, 2008 at 01:17:31PM -0600, Chongkai Zhu wrote:
> > According to the implementation, srfi/48 provides s:format but not
> > format.
> >
> > Given that we can import modules with names that shadows the lang
> > we are using (in a module), is it time to remove all the s: prefix
> > for srfis?

I think that there is still a point to continue using the current
practice that several srfis use:

  srfi/48/format  provides  s:format
  srfi/48         provides  format

Getting that is simple, I just changed

  #lang s-exp srfi/provider srfi/48/format

to

  #lang s-exp srfi/provider srfi/48/format #:unprefix s:

so if there are similar cases tell me and I'll do them too.  (It
doesn't look like the docs need to be updated, but tell me if they
do.)



> That sounds like a bad idea to me.  If we remove the prefix, then it
> would be all too easy for an unsuspecting developer who doesn't know
> the full interface of SRFI n (or some other module) to shadow one of
> the scheme language's built-in indentifiers unexpectedly, with
> resulting behavior that's hard to debug.
> 
> On the other hand: speaking personally, I almost always require
> SRFIs with an explicit prefix, to avoid this exact problem.  It'd be
> nice to be able to, in this case, refer to srfi-48:format instead of
> srfi-48:s:format.
> 
> On the third hand: expecting users to specify their own prefix for
> SRFIs/modules is not a suitable general solution.  It's especially
> not sufficient if omiqqtting the prefix can silently cause bugs in the
> manner described above.

I think that the above layout is a reasonable compromise.  Or maybe
even add thigs like srfi/s48 that will always use an `s:' prefix?  (So
you don't have to read the docs/code to know the prefix that you
need.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.