[cvs-nhc98] patch applied (hat): Fix many faults in the import/export mechanism.

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Oct 10 07:09:08 EDT 2006


Wed Oct 17 05:57:21 PDT 2001  malcolm
  * Fix many faults in the import/export mechanism.
  
  New features
  ------------
    * The compiler now treats explicitly named constructors and methods
      correctly, e.g. in
          module M (T(A,B), C(f,g)) where
      or
          import M (T(A,B), C(f,g))
      only the constructors A and B of datatype T, and only the methods f and g
      of class C, are exported/imported.
  
    * The declaration
          import qualified M (f)
      is now accepted without complaint, whereas previously it needed to be
          import qualified M (M.f)
      in some circumstances.
  
    * It is now possible to name selectors explicitly in an export/import
      list, provided the type they select over is *not* exported/imported.
  
  
  Implementation
  --------------
  The symbol table entries
      InfoConstr, InfoMethod, InfoField
  now each have an extra field 'ie' which determines whether an
  individual constructor/method/field is to be re-exported, rather than
  relying on the corresponding tag of the relevant InfoData/InfoClass
  symbol.
  
  The IE type is extended to distinguish the various cases of:
      IEall  - re-export with all constructors/methods  e.g. C(..)
      IEsome - re-export with some constructors/methods  e.g. C(f,g)
      IEabs  - re-export with no constructors/methods  e.g. C() or C
      IEnone - do not re-export
  and
      IEsel  - re-export this selected constructor/method individually
  
  The interface file (.hi) now indicates which individual
  constructors/methods are actually exported in the {-# NEED {C f g} #-}
  annotation.  Most importantly, *all* the actual constructors/methods
  are listed in the datatype/class definition that follows, because the
  numerical ordering is required to generate correct code.  However, when
  importing such a datatype/class, the non-visible constructors/methods
  are renamed internally to something like "Unknown.Constructor_n" in
  the symbol table, to ensure that they cannot be used.  These new names
  will appear any new interface file that is generated due to a further
  re-export.

    M ./src/compiler98/CaseLib.hs -1 +1
    M ./src/compiler98/DbgDataTrans.hs -15 +24
    M ./src/compiler98/DbgDumpSRIDTable.hs -1 +1
    M ./src/compiler98/DbgDumpSRIDTableC.hs -1 +1
    M ./src/compiler98/DbgReplaceConstr.hs -4 +4
    M ./src/compiler98/DbgTrans.hs -20 +19
    M ./src/compiler98/Export.hs -97 +165
    M ./src/compiler98/FFITrans.hs -2 +2
    M ./src/compiler98/FSLib.hs -5 +12
    M ./src/compiler98/GcodeFix.hs -1 +1
    M ./src/compiler98/GcodeSpec.hs -9 +28
    M ./src/compiler98/IExtract.hs -79 +159
    M ./src/compiler98/Import.hs -14 +14
    M ./src/compiler98/Info.hs -153 +140
    M ./src/compiler98/IntState.hs -17 +17
    M ./src/compiler98/Need.hs -29 +25
    M ./src/compiler98/ParseI.hs -44 +82
    M ./src/compiler98/PreImp.hs -23 +43
    M ./src/compiler98/PreImport.hs -32 +28
    M ./src/compiler98/Remove1_3.hs -3 +4
    M ./src/compiler98/Rename.hs -60 +76
    M ./src/compiler98/RenameLib.hs -27 +37
    M ./src/compiler98/ReportImports.hs -13 +13
    M ./src/compiler98/TokenId.hs -1 +2
    M ./src/compiler98/TokenInt.hs -1 +1
    M ./src/compiler98/TypeUtil.hs -5 +5


More information about the Cvs-nhc98 mailing list