chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] r7rs modules


From: John Cowan
Subject: Re: [Chicken-hackers] r7rs modules
Date: Sat, 10 Nov 2012 17:11:53 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Peter Bex scripsit:

> This won't work cleanly with native Chicken modules.  For example,
> (use (scheme base)) will give an error (which would be extensible),
> but does (use (only x y)) imply loading a module named (ONLY X Y)
> or does it imply loading X and importing only the Y identifier?

The latter.  De facto, R7RS library names beginning with "only", "prefix",
"except", and "rename" are forbidden, so I wouldn't worry about it.
(That is, you can write them, but you can't import them.)

I think the Right Thing is to internally translate "(foo bar)" into
"foo-bar".  Thus "(import (srfi 1))" will Just Work.  Technically
there could be problems if someone has both "(foo bar)" and "(foo-bar)"
libraries, but I think that corner case can be documented and ignored.

An alternative would be to treat "(foo bar)" as a module named
foo/bar, in which case it would be loaded from a subdirectory.

> Also, (module foo = (scheme base)) does mean "instantiate the functor
> named SCHEME with the module named BASE", or does it mean "FOO is an
> alias for (SCHEME BASE)".

The former, I think.  The latter should probably be written "(module
foo = (library (scheme base)))".  It's for this reason that we decided
to talk of libraries rather than modules, and to say "define-library"
rather than just "library" as R6RS did.

> One way to do this would be to extend our own "native" syntax to
> allow complex module names that are vectors:

Ugh.

> We're free to have (and keep) 'use', since R7RS doesn't define it.
> The only trouble is that the module names are defined to be lists
> (AFAIK single symbols aren't even allowed).

Indeed, which means that R7RS import will not collide with Chicken import.
The important difference is that R7RS import implies loading if the module
is not yet loaded: i.e. it is like Chicken "use".  I think making Chicken
"import" do this would be a reasonable change.

-- 
Overhead, without any fuss, the stars were going out.
        --Arthur C. Clarke, "The Nine Billion Names of God"
                John Cowan <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]