[Larceny-users] library name clashes in larceny with the -r7rs -program options

John Bignucolo john.bignucolo at gmail.com
Fri Jan 6 06:13:27 EST 2017


Thanks Will.

Since it's release in July 2013, I had assumed (hoped?) that the authors of
the SRFI libraries would have updated their implementations to play nicely
with R7RS. But it's a big job to maintain compatibility between R5RS, R6RS
and R7RS so it's no surprise that there are inconsistencies.

Thanks for the clear explanation of the way names are resolved and
libraries imported.

Regards,
John

On 6 January 2017 at 01:22, William D Clinger <will at ccs.neu.edu> wrote:

> John Bignucolo wrote:
>
> > I ran into a problem when I tried to change the program to use the
> > string-join function from SRFI-13.
> >
> > The '-r7rs' '-program' options require that you import everything you
> need.
> > Since string-join is part of SRFI-13 I thought all I needed to do was:
> >
> > (import (scheme base)
> >         (scheme load)
> >         (scheme write)
> >         (scheme process-context)
> >         (srfi 13))
>
> > But this generated an error:
> >
> > Syntax violation: import
> >
> > Different bindings for identifier imported from libraries () and (srfi
> :13
> > strings)
> >
> > Form: string-for-each
>
> A lot of the SRFI specifications are incompatible with R7RS
> libraries or R6RS libraries or other SRFI libraries.  You have
> to resolve those conflicts on your own, because Larceny can't
> just guess which definition you want.
>
> In this case, the specs for string-map and string-for-each
> in SRFI 13 are incompatible with their R7RS specifications.
> There are various ways to resolve that.  If you don't need
> string-map and string-for-each, or you are willing to work
> with the R7RS versions of those procedures, you can write
>
> (import (scheme base)
>         (except (srfi 13) string-map string-for-each))
>
> > I was able to able to get it work by changing the srfi import
> > definition to be:
> >
> > (only (srfi 13) string-join)
>
> That's another good way to resolve the conflicts, and it's
> an even better way if string-join is all you need.
>
> > But this resulted in a five-fold increase in runtime, due I assume,
> > to a longer startup time required to find string-join:
>
> The longer startup time is caused by the implementation of
> (srfi 13) in Larceny.  The (srfi 13) library imports the
> (srfi :13) library, which imports six R6RS libraries, two
> other SRFI libraries, the R7RS (scheme base) library, and
> the (larceny shivers-syntax) library, which defines the
> macros Olin Shivers used to write his implementation of
> (srfi 13).  Some of those libraries may import yet other
> libraries.
>
> It just takes a while to load all those libraries.
>
> You can examine the source code for those libraries in
>
>     lib/SRFI/srfi/13.sld
>     lib/SRFI/srfi/%3a13.sls
>
> (et cetera)
>
> Will
>



-- 
John Bignucolo
john.bignucolo at gmail.com
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the Larceny-users mailing list