[racket] package-source require forms for new package system

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Dec 1 06:10:22 EST 2014


One of the key ideas of the package system is that it always uses
"external linking". This means that modules never mention the names of
packages; they only mention the names of modules (recall from the
other thread that module names have no connection to package names.)
This means that only the state of the Racket installation determines
the meaning of module names. This is very similar to operating
systems. On an ArchLinux machine, when you run "sh", the program that
is run depends on the packages you have installed and your PATH. (The
"PATH-like" idea in Racket is the installation.)

The upside of this is that it is easy for modules to migrate from one
package to another as it is convenient to the package author and that
it is easier to fork and take over dead code, since pre-existing code
written "for one package" seamless works when a new package provides
the module. (I use scare quotes because this REALLY means that code is
never written "for one package".) Similarly, you can be sure that code
somewhere will only use exactly the versions of modules you have
installed and never seek to download random code from the Internet.

The downside of this is that random code on the Internet is hard to
interpret because you don't know which packages the modules come from.
There are two ways the package system deals with this. First, if the
code is part of a package, then its info file names its dependencies,
which are package sources (like the ones you cite.) Second, if the
code is not part of a package, and you run it with a tool like
DrRacket, then when you run a program like

#lang racket/base
(require avl)

and don't have the "avl" package installed, the tool can give an error
message like:

standard-module-name-resolver: collection not found
 for module path: avl
 collection: "avl"
 in collection directories:
   ... [57 additional linked and package directories] in: avl
  packages that provide the missing module: [update catalog].
    avl  [install].

where [install] is a link that causes DrRacket to install the package.

This is possible because the package system organizes the set of
packages into concentric rings that provide fewer and fewer
guarantees, with the first two rings having the property that every
module name is unique, i.e. every package can be installed
simultaneously with no conflicts. This is not a special thing about
our package catalog however, anyone may create a catalog referenced by
DrRacket that it will search for the providing package for modules.


On Mon, Dec 1, 2014 at 2:10 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> Can I do `require` forms like this?
>     (require http://code_man.cybnet.ch/racket/3d-model.zip)
>     (require git://github.com/samth/abnf)
> Neil V.
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Jay McCarthy

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

Posted on the users mailing list.