[plt-scheme] planet require idea

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Thu Mar 20 12:41:14 EDT 2008

On Thu, Mar 20, 2008 at 12:29 PM, Jacob Matthews <jacobm at cs.uchicago.edu> wrote:
> How about (in BNF form):
>
>  ;; new require spec ::= (planet SPEC)
>  ;; SPEC     ::= OWNER "/" PACKAGE VERSPEC ":" PATHSPEC
>  ;; VERSPEC  ::= "" | "/" MAJ MINSPEC
>  ;; MINSPEC  ::= "" | "/" PMINSPEC
>  ;; PMINSPEC ::= MIN | ">=" MIN | "<=" MIN | "=" MIN | MIN "-" MIN
>  ;;
>  ;; where PACKAGE is a string naming a package with or without the final ".plt"
>  ;;       and PATHSPEC is a normal file (possibly with path) specification
>
>  Some examples:
>
>  (planet planet/test-connection:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt"))
>
>  (planet planet/test-connection/1:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1))
>
>  (planet planet/test-connection/1/0:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1 0))
>
>  (planet planet/test-connection/1/>=2:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1 (+ 2)))
>
>  (planet planet/test-connection/1/<=2:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1 (- 2)))
>
>  (planet planet/test-connection/1/=5:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1 (= 5)))
>
>  (planet planet/test-connection/1/1-8:test-connection.ss)
>  is equivalent to
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1 (1 8)))
>
>  (planet planet/test-connection/1/1-8:subpath/subfile.ss)
>  is equivalent to
>  (planet "subpath/test-connection.ss" ("planet" "test-connection.plt" 1 (1 8)))
>  and
>  (planet "test-connection.ss" ("planet" "test-connection.plt" 1 (1 8)) "subpath")
>
>
>  In all of these cases the initial "planet/test-connection" could be
>  replaced by "planet/test-connection.plt" with the same effect.
>
>  Does this look reasonable to people?

Pretty good.  I think your examples would have been illustrative if
the owner weren't "planet"; seeing (planet planet/foo...) is a bit
misleading, as you're not suggesting that the term "planet" needs to
be repeated.

The one thing I'd suggest is changing the delimiters around version
numbers.  You have:

owner/package/major/minor:path

I'd prefer:

owner/package:major.minor/path

The colon and period are negotiable, but the path is, well, a path,
and / seems like the sensible delimiter; it also means in the
version-nonspecific case that the only delimiter is /. (<-- period is
only to end the sentence)  Using distinct delimiters for the version
numbers set them off as different; everything else is picking a file,
those numbers are picking which file by that name.

Also, major.minor is how we write version numbers informally anyway,
it make sense to reuse the notation here, assuming we aren't allowing
decimal literals in our major version numbers.

-- 
Carl Eastlund


Posted on the users mailing list.