Legal package names

Simon Marlow simonmar at microsoft.com
Fri Mar 11 04:13:19 EST 2005


On 11 March 2005 07:44, Adrian Hey wrote:

> On Thursday 10 Mar 2005 1:47 pm, Malcolm Wallace wrote:
>> I think it is something to do with the regular expression describing
>> legal Cabal package names.  A package name basically has three
>> components: name, version number, and tag.  The middle part, the
>> version number, may contain dots, but I imagine the outer parts,
>> the name and tag, may not?
> 
> Thanks. What's a "tag", BTW? (Cabal docs don't mention it AFAICS,
> but maybe I've missed something).

The tag is part of the version: a version has the form

  version ::= digit+ ('.' digit+)*  ('-' alphanum+)*

Tags are largely ignored by Cabal, they're just for adding useful
information to a version (eg. you might add a tag for platform type,
release date, or compiled-by).  In particular, the tags are ignored in
the ordering relation between versions.

A package name currently has the form 

  pkgname ::= alphanum+ ('-' alphanum+)*

and a package identifier has the form

  pkgid ::= pkgname ['-' version]

Allowing dashes in package names is quite common (look at the names of
RPMs on a Linux system, or the packages on a FreeBSD system, for
example).  We already have problems with pkgids like "foo-1", which is
ambiguous.  The tools reject ambiguous package identifiers.

Allowing '.' in a package name would introduce more possibilities for
ambiguity: even 'foo-1.0' becomes ambiguous.  So it's not simply a case
of generalising the syntax slightly: we need to specify how to resolve
the ambiguity.  Restricting the components of the package name to start
with an alphabetic character only seems a possibility.

Cheers,
	Simon




More information about the Libraries mailing list