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). 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? Simo If anyone else is interested, I'll elaborate Thomas and Iavor's example slightly: | module Cambridge1(module Simon) where | import PJ as Simon | import qualified Marlow as Simon | | module Cambridge2(module Simon) where | import PJ as Simon | import Marlow | | module Cambridge3(module Simon) where | import PJ as Simon | import Marlow as Simon | | module Marlow where | simon = "Simon Marlow" | | module PJ where | simon = "Simon PJ" So in Cambridge1 'simon' is unambiguous 'Simon.simon' is ambiguous But in Cambridge2 'simon' is ambiguous 'Simon.simon' is unambiguous In Cambridge 3 both are ambiguous The spec as it stands says that the export item 'module M' identifies those items x that are in scope both as 'x' and as 'M.x'. In both Cambridge1 and Cambridge2, there is only one such entity, so both are legal. (The fix I proposed yesterday would render Cambridge1 illegal.) In Cambridge3, the rule would specify that both entities "simon from module PJ" and "simon from module Marlow" are identified by 'module Simon'. And that is illegal because of the last clause of 5.2 specifies that one cannot export two entities with the same unqualified name.
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 | ==================================================
participants (2)
-
Iavor S. Diatchki -
Simon Peyton-Jones