(* Pickler / unpiclker to be used with the output of DumpEnv *) structure Pup = struct fun pickUnpick { context, env = newenv, guid } = let val m = GenModIdMap.mkMap context fun up_context _ = m val { hash, pickle, exportLvars, hasExports } = PickMod.pickleEnv (PickMod.INITIAL m) newenv val pid = Rehash.addGUID { hash = hash, guid = guid } val newenv' = UnpickMod.unpickleEnv up_context (pid, pickle) in { pid = pid, pickle = pickle, exportLvars = exportLvars, exportPid = if hasExports then SOME pid else NONE, newenv = newenv' } end fun pickBase (baseenv) = pickUnpick {context=StaticEnv.empty, env=baseenv, guid=""} end