Re: curiosity, bug, or just dead code?

Stefan O'Rear <[email protected]> Mon, 10 Sep 2007 19:22:25 -0700
Newsgroups gmane.comp.lang.haskell.glasgow.bugs,gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
--===============0323003001==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="VS++wcV0S1rZb1Fb"
Content-Disposition: inline


--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Sep 11, 2007 at 12:02:26AM +0100, Claus Reinke wrote:
> consider this module, which is accepted by ghci-6.6.1:
>
>    module T where
>    import qualified Prelude as T(length)
>    import Prelude(length)
>    length =3D 0
>
> there is no way to refer to either length, as both 'length' and 'T.length=
'=20
> are ambiguous (ghci complains on uses of either name). but is it a bug?
>
> then again, everything is implicitly exported, and there are two possible=
=20
> 'T.length'.. (hugs [20051031] complains about conflicting exports, on=20
> loading T).
>
> now for the good part:
>
>    module Q where
>    import T
>    main =3D print T.length
>
> loads fine, and running main returns 0.
>
>    Ok, modules loaded: Q, T.
>    *Q> main
>    0
>
> so this must be a bug, right? or a matter of interpretation?
>
> not everything is exported implicitly: imported items, whether unqualifie=
d=20
> or qualified and renamed to share the current module as qualifier are not=
=20
> exported by default. and changing=20
>    module T where
>
> to=20
>    module T(module T) where
>
> leads to conflicting export errors on load in ghci.
>
> currently, i think ghci is right, and hugs is wrong (note that
> my hugs is rather old, though), but it wasn't what i expected.

This is a known bug in hugs; quoth the user's guide:

In Haskell 98, a missing export list means all names defined in the
current module. In Hugs, it is treated as "(module M)", where M is the
current module. This is almost the same, differing only when an imported
module is aliased as M.

Yes, this is a dark corner in H98.

Stefan

--VS++wcV0S1rZb1Fb
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG5fvhFBz7OZ2P+dIRAs8vAJ9LDOJF6B8xt+PP8AmlGBcJnPqXcgCgreYv
StMWw6gD1xQQHMd+lhWghxI=
=ftHM
-----END PGP SIGNATURE-----

--VS++wcV0S1rZb1Fb--

--===============0323003001==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

--===============0323003001==--