Re: Contexts and DumSave
- To: mathgroup at smc.vnet.net
- Subject: [mg54849] Re: Contexts and DumSave
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Fri, 4 Mar 2005 05:07:45 -0500 (EST)
- Organization: Uni Leipzig
- References: <d060us$kqa$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, and DumpSave["mypack.mx","mypack`"] instead of DumpSave["mypack.mx",expr] does not help ? Regards Jens "Geronimo" <kalymereauNOSP at Myahoo.fr> schrieb im Newsbeitrag news:d060us$kqa$1 at smc.vnet.net... > Hi > > I have a package mypack.m in which I compute a time-consuming expression: > > BeginPackage["mypack`"] > > expr::usage="stuff" > > Begin["`Private`"] > > expr = (complicated) > > End[] > > EndPackage[] > > So I am considering to save the expression with a > DumpSave["mypack.mx",expr] > inside the package. Thus the full name of the expression is mypack`expr > > Then in a notebook I want to load the expression > << "mypack`" > > If the mypack.mx file does not exists, then mypack.m is called and the > expression is computed and exported. $ContextPath is updated with mypack` > > However if mypack.mx does exist, then mypack.m is not called (OK), the > expression is loaded from the .mx file and I can quickly have it with > mypack`expr. But in this case $ContextPath is not changed, so the short > name expr is not recognized. > > In other words, expr only exists within context mypack`, but the << > instruction does not load the appropriate context when the .m file is not > called. > > Thus my question is: when the .mx file is created within a package, how > can > I get the expressions inside without typing their full name ? > > I could hack $ContextPath but I guess this is not the correct way to do. > > I don't want to compute and DumpSave the expression within the global` > context, which is an obvious solution to my problem. > > Many thanks. > > Geronimo >