Simon Peyton-Jones | 5 Nov 11:07 2002
Picon

RE: Module re-exportation weekend puzzler

Folks

Another minor H98 glitch.  Consider this:

| > > module D (module Char) where
| > > { import qualified Char; import List as Char }
| >
| > Everything in List, nothing from Char.
| 
| Interesting... what happens when List and Char overlap here?  Suppose
| there exists entities List.f and Char.f, then it would be an error to
| refer to Char.f in the body of the module.  On export lists, the
report
| says:
| 
|   The form "module M" names the set of all entities whose
|   unqualified name, e, is in scope, and for which the qualified
|   name M.e is also in scope and refers to the same entity as e.
| 
| Perhaps this could be clarified by insertion of the word
"unambiguously"
| before "refers to the same entity as e".  It's not essential, but it
| would make the expected behaviour in this case clearer.

I agree with this.  (Actually GHC gets it wrong right now.)   Another
way to say it is this:

	The export item 'module M' exports all entities e such that
	a) The qualified name M.e is unambiguous and refers to that
entity
(Continue reading)

Iavor S. Diatchki | 6 Nov 01:46 2002
Picon

Re: Module re-exportation weekend puzzler

Hi,

Simon Peyton-Jones wrote:

  >Folks
  >
  >Another minor H98 glitch.
  >
Are you saying that you think the report doesn't fully define the
meaning of the module system, or just that difficult to understand and
needs to be clarified?

  >  Consider this:
  >
  >| > > module D (module Char) where
  >| > > { import qualified Char; import List as Char }
  >| >
  >| > Everything in List, nothing from Char.
  >|
  >| Interesting... what happens when List and Char overlap here?
  >
If only there was a formal specification one could consult in cases like
this! But wait a minute. There is one [1]!

  >... I agree with this.  (Actually GHC gets it wrong right now.)   Another
  >way to say it is this:
  >
  >	The export item 'module M' exports all entities e such that
  >	a) The qualified name M.e is unambiguous and refers to that
  >entity
(Continue reading)

Thomas Hallgren | 6 Nov 01:34 2002
Picon

Re: Module re-exportation weekend puzzler

Hi,

Simon Peyton-Jones wrote:

>Folks
>
>Another minor H98 glitch.
>
Are you saying that you think the report doesn't fully define the 
meaning of the module system, or just that difficult to understand and 
needs to be clarified?

>  Consider this:
>
>| > > module D (module Char) where
>| > > { import qualified Char; import List as Char }
>| >
>| > Everything in List, nothing from Char.
>| 
>| Interesting... what happens when List and Char overlap here?
>
If only there was a formal specification one could consult in cases like 
this! But wait a minute. There is one [1]!

>... I agree with this.  (Actually GHC gets it wrong right now.)   Another
>way to say it is this:
>
>	The export item 'module M' exports all entities e such that
>	a) The qualified name M.e is unambiguous and refers to that
>entity
(Continue reading)

Simon Marlow | 6 Nov 12:06 2002
Picon

RE: Module re-exportation weekend puzzler


> The meaning of "module M" in export lists is rather subtle, and the
> above reformulation (or the one-word change) seems to make a subtle
> change to it. It is not just a clarification. Is that what 
> you intend?!

It depends, I guess, on your interpretation of the report as it stands.
It wasn't clear to me whether it is legal to export an entity, using the
'module M' syntax, whose qualified name is ambiguous.  Admittedly, if
I'd checked your specification I'd have noticed that your interpretation
differed from mine, sorry about that.

Nevertheless, since there are two interpretations, the report should
clarify which one is meant.

> A nice aspect of our formal semantics is that the computation of the
> exports and inscope relations, which includes fixpoint 
> iteration to give
> meaning to recursive modules, and the error checking can be kept
> separate. The change proposed above means that the error 
> checking has to
> be integrated with the fixpoint iteration (or that the fixpoint
> iteration has to return more than the resulting inscope/export
> relations), and thus complicates the specification.

Ok, that sounds like a good reason to prefer your current
interpretation.

Cheers,
	Simon
(Continue reading)

Simon Peyton-Jones | 6 Nov 12:21 2002
Picon

RE: Module re-exportation weekend puzzler

Thomas, Iavor,

Thanks for your message.

| Are you saying that you think the report doesn't fully define the
| meaning of the module system, or just that difficult to understand and
| needs to be clarified?

The former, and hence it ought to be clarified.  But after contemplating
your message, your fine formal specification, and then looking at the
Report again, I conclude that my proposed fix was wrong.  (I elaborate
below.)  

The current wording is this:

|   The form "module M" names the set of all entities whose
|   unqualified name, e, is in scope, and for which the qualified
|   name M.e is also in scope and refers to the same entity as e.

What is un-clear about this is the phrase "...for which the qualified
name M.e is also in scope and refers to e".   Unclear because it could
be read as saying 
	EITHER: that M.e can refer unambiguously only to this one
entity, 
	OR: that e is in scope under the name M.e (but M.e could be
ambiguous)

Either would make sense, but the latter is both more symmetrical (see
Cambridge1 vs Cambridge2 below) and matches your formal spec (from which
we should not lightly deviate).
(Continue reading)

Iavor S. Diatchki | 6 Nov 22:30 2002
Picon

Re: Module re-exportation weekend puzzler

hi,

sorry for the double post yesterday, thomas had some sort of a problem 
sending mail to the list, so i sent the message instead, but i guess 
eventually both messages ended up being posted.

Simon Peyton-Jones wrote:

> So I am happy to adopt your interpretation, but I'd like to clarify 
> the wording.
> Here's an alternative sentence:
>    The form "module M" names the set of all entities that are in
>    scope with both an unqualified name 'e' and a qualified name
>    'M.e'.
>
> Would that be better?  Can you suggest anything else?

i think this formulation is better.

bye
iavor

--

-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================
(Continue reading)


Gmane