[racket] What is "inferred package scope"? [was: raco pkg install/remove problem]

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Aug 19 10:16:04 EDT 2013

At Mon, 19 Aug 2013 09:43:00 -0400, Greg Hendershott wrote:
> The term "package scope" is defined as one of "user", "installation",
> or "shared", here: [...]

In v5.90.x, the `shared` scope has gone away.

http://www.cs.utah.edu/plt/snapshots/current/doc/pkg/Package_Concepts.html#%28tech._package._scope%29

Meanwhile, a directory can be a scope. A directory scope is intended
for a kind of advanced level of configuration when you want things even
outside `installation` --- analogous to "/usr/local" versus "/usr",
where "/usr/local" corresponds to `installation` scope.


> But:
> 
> 1. What is the "inferred" bit?

A subcommand like `raco pkg update` infers a scope based on the package
names that you provide. For example, if your default package scope is
`installation`, and you've installed "sirmail" in `user` scope, then

   raco pkg update sirmail

infers that you mean to update "sirmail" in `user` scope.


> 2. Why do `raco pkg` messages about "inferred package scope" show a
> path, and not "user", "installation", or "shared'?

Only because scope inference was broken.

That should be fixed, finally (as of late yesterday).


> 3. Is this information that a casual user of `raco pkg` needs to
> know/understand?

Probably not. If you never change the scope from default, and as long
as scope inference is not broken, then it shouldn't show up so much.


Scopes do show up when you use `raco pkg show`, since packages are
sorted into their scopes. And if you build from the git repo, you'll
see three scopes:

 * .../racket/share/devel-pkgs
 * installation
 * user

The ".../devel-pkgs" scope is used to separate the packages that `make`
installs from any installation-wide packages that you might install
yourself --- so that when you run `make` again and the set of packages
that `make` wants to install has changed, then it knows which are
which. In other words, the default makefile target uses a kind of
"/usr" versus "/usr/local" distinction.


Users who install a distribution, including a snapshot, will see only
two scopes --- `installation` and `user` --- which I think won't be
confusing.


One more detail: In a fresh build via the git repo, the default package
scope is set to `installation`, while other ways of getting Racket have
the default of `user`. That default scope fits with shifting the normal
installation-wide packages into a ".../devel-pkgs" scope for a
repo-based build. The shift, in turn, is intended to help keep your
checkouts separate from each other without you thinking about it too
much.


Posted on the users mailing list.