In DynFlags there is a pkgDatabase field which should contain the original packages database. I saw that it is never updated now and it is always Nothing. In the same time Packages.initPackages is using it to determine whether or not to read the package database from the configuration files. In that way each call to Packages.initPackages and respectively to GHC.setSessionDynFlags will cause database reloading. In the PackageState there is a origPkgIdMap field which is updated but never used after that.
Calling initPackages from setSessionDynFlags might be over simplification here. I am calling setSessionDynFlags repeatedly but without changing the packageFlags field. In this case it isn't necessary to call initPackages. I hope it will not be too slow. Cheers, Krasimir On 9/24/06, Ian Lynagh <[EMAIL PROTECTED]> wrote:
Mon Sep 18 18:24:48 PDT 2006 Simon Marlow <[EMAIL PROTECTED]> * Packages cleanup, and allow new packages to be loaded with :set again This cleans up the package subsystem a little. There are some changes to the GHC API as a result. - GHC.init and GHC.initFromArgs are no longer necessary. - GHC.newSession takes the root of the GHC tree as an argument (previously passed to GHC.init). - You *must* do GHC.setSessionDynFlags after GHC.newSession, this is what loads the package database. - Several global vars removed from SysTools - The :set command in GHCi can now cause new packages to be loaded, or can hide/ignore existing packages. M ./compiler/ghci/InteractiveUI.hs -19 +17 M ./compiler/ghci/Linker.lhs -1 +1 M ./compiler/main/CodeOutput.lhs -1 +1 M ./compiler/main/DriverPipeline.hs -4 +4 M ./compiler/main/DynFlags.hs -17 +17 M ./compiler/main/GHC.hs -43 +26 M ./compiler/main/Main.hs -17 +19 M ./compiler/main/Packages.lhs -149 +225 M ./compiler/main/SysTools.lhs -67 +14 _______________________________________________ Cvs-ghc mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/cvs-ghc
_______________________________________________ Cvs-ghc mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/cvs-ghc