Simon Peyton-Jones wrote:
Brian
Actually re-reading my post I realised I may have sounded a bit
negative about the hard work you'd done to collate the various
responses to form the wiki proposal - my apologies
Thanks -- email is a fragile medium!
I've followed your suggestion and made a separate page at
http://hackage.haskell.org/trac/ghc/wiki/GhcPackagesAlternativeProposal
Jolly good, thank you. I've looked at it.
Happily, so far as I can see the two proposals are identical! At
least I cannot identify any points of difference. If you think they
differ, can you say where?
They are more similar than I realised at first. However there are some minor
issues:
1) Qualified names:
import A.B.C( T1 ) from "foo"
import A.B.C( T2 ) from "bar"
type S = A.B.C.T1 -> A.B.C.T2
I'd suggest that the above should give a compiler error that A.B.C is
ambiguous (as a qualifier), rather than allowing T1 to disambiguate it,
because otherwise it allows people to write code that could be very hard to
understand ie within the code, every occurrence of A.B.C as a qualifier
should refer to the same module. (Otherwise the thing qualified qualifies
the qualifier that's qualifying it...)
2) Syntax
I think it's important that it's as easy to use per-package namespaces as
the existing shared namespace, and so my syntax doesn't require the use of
an extra keyword (ie "from"), and this works syntactically because package
names are string literals. (I see the original proposal has now changed to
advocate that package names should indeed be quoted.)
Your spec is a little unclear about whether the package name is
compulsory in every import. Under "The best of both worlds / Shared
name space" you say that plain "import A.B.C" looks in all exposed
packages and bleats if its ambiguous. That's what we propose, and
it's satisfactorily backward compatible. And that is what your syntax
implies too.
In my spec, if you omit the package name you get an "old-style" import using
the shared namespace, and if you supply a package name you get a "new-style"
import that only searches in the specified package:
import A.B.C -- search home + exposed as is done at the moment
import "" A.B.C -- search home package only
import "pkg" A.B.C -- search "pkg" only
So the first variant gives backwards compatibility and the other two
variants give the new per-package namespaces.
So apart from using "" to answer the question about importing from the home
package, minimalist syntax, and the minor issue about qualification, both
proposals are indeed now identical, which is great! :-)
Regards, Brian.
--
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.
http://www.metamilk.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe