Changes between Initial Version and Version 1 of PermitSignaturesInExports


Ignore:
Timestamp:
Feb 22, 2006 3:05:55 PM (10 years ago)
Author:
malcolm.wallace@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PermitSignaturesInExports

    v1 v1  
     1= Permit Signatures in Export Lists =
     2There is a good case to be made for permitting the inclusion of function signatures in the export list of a module. People often write them there anyway in comments, but the comments are not checked against the implementation, so changes can go unnoticed. There is also a good software engineering principle that says you should specify your interfaces as fully as possible. Signatures in export lists should be considered equivalant to signatures specified in the module itself at the top level for all purposes. If there are signatures in both the interface and the implementation, they should be identical (not just unifiable).
     3
     4If we /required/ signatures in export lists (and always required a full export list too), this would solve the recursive module problem for some compilers very simply. The export list would represent exactly the information currently contained in ghc's hs-boot files (and nhc98's hand-written .hi bootstrapping method). Other compilers such as jhc and helium have no problem with recursive modules as is.  However, I do not yet propose that signatures be mandatory - just permitting them would already be a large and useful step.
     5
     6== Grammar changes ==
     7
     8The export syntax changes trivially from
     9
     10{{{
     11    export  -> qvar
     12            |  qtycon [ (..) | ( cname_1, ... , cname_n ) ]     (n>=0)
     13            |  qtycls [ (..) | ( var_1, ... , var_n ) ]         (n>=0)
     14            |  module modid
     15}}}
     16
     17to
     18
     19{{{
     20    export  -> qvar [ :: type ]
     21            |  qtycon [ (..) | ( cname_1, ... , cname_n ) ]     (n>=0)
     22            |  qtycls [ (..) | ( var_1, ... , var_n ) ]         (n>=0)
     23            |  module modid
     24}}}