[jhc] bug in handling of -p flag

John Meacham john at repetae.net
Mon Sep 14 19:17:15 EDT 2009


On Sun, Sep 13, 2009 at 05:21:35PM -0400, David Roundy wrote:
> It looks like the handling of the -p flag is buggy, or at least
> counterintuitive.  I've started playing with your new --list-libraries
> output, and I can now figure out which packages export which modules,
> which is great.  What's not so great is that there doesn't seem to be
> a way to uniquely specify the package that I want to import.  It seems
> that only the BaseName is supported with -p, so I can't use either the
> Name, or the FilePath, or the hash of the library I want.  It's not a
> huge deal, since usually one wants the first version of the library in
> the path, but it'd be much nicer to allow us to specify any of those
> four specifiers, BaseName, Name, FilePath *or* hash.  I'm not sure
> what I'd want franchise to do.  Either FilePath or hash is unique, and
> FilePath is much friendlier to read.  But neither is as user-friendly
> as Name.

Yeah, the -p flag needs to be extended. I was thinking of allowing the
following:

<hash>: load exactly the library specified by <hash>, which must appear
in the normal library search path.

<filename>.hl: load the specified library by file name, which need not be in the library
search path.

basename(-version): choose the latest library with 'basename' where
version is a prefix of its version. 

I figure this should cover 95% of all the cases people need, and the
other 5% could be filled by external tools such as franchise or cabal
that can use their own logic to specify libraries directly by hash.

However, there are some odd cases, what if you have -pbase and -p<hash>
where hash specified a 'base' which isn't the newest version? is this a
conflict or should the specific hash version of base be used? hmm...

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/


More information about the jhc mailing list