[racket-dev] package name restrictions - why?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jul 31 14:42:58 EDT 2013

At Wed, 31 Jul 2013 14:17:18 -0400, Tony Garnock-Jones wrote:
> On 07/31/2013 02:11 PM, Jay McCarthy wrote:
> > The restriction is primarily because they appear in URLs as single
> > path segments.
> Could we then widen the restriction to be [-A-Za-z0-9._~!$&'()*+,;=], 
> following http://tools.ietf.org/html/rfc3986#section-3.3 (but 
> disallowing percent-escaping)?

Package names show up in all sorts of other contexts, too, such as
filesystem paths. In all cases, there is some encoding that would work,
but it's a pain and a source of subtle bugs.

Note that the programming language in which we'd have to deal with
encoding is sometimes not nearly as nice as Racket. For example,
including a package with "$" in its name as part of a `PKGS=...'
argument to `make' is going to fail in lots of ways (since the `PKGS'
value flows back and worth between `make' and `sh' or `cmd.exe').

Finally, there's the question of inference that `raco pkg install' and
other tools perform on a string that represents a package source.
Keeping the package-name grammar simple makes that inference more

> I ask because I find the occasional package whose git repo is named 
> "foobar.rkt/", and it's inconvenient to have to (a) make up and (b) 
> remember a package name different from "foobar.rkt" for that case.

I see what you mean, and yet "foobar.rkt" seems like a strange name for
a Racket package. In particular, I'd expect it to be inferred as a
filename source, instead of a package-name source, if we ever manage to
make individual files act as packages (as some have suggested).

Posted on the dev mailing list.