MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Loading Packages in a loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84469] Re: [mg84448] Re: Loading Packages in a loop
  • From: "Matthias Gottschalk" <mgott at gfz-potsdam.de>
  • Date: Wed, 26 Dec 2007 05:11:13 -0500 (EST)
  • References: <fknvm0$6cq$1@smc.vnet.net>

Hello Jens

Sorry, these are no solutions.

The first proposed change
  

> << CleanSlate.m;
> 
> 
> Do[
>    $HistoryLength = 0; (* some other things to save 
>memory
> *)
>    Unprotect[In, Out]; (* some other things to save 
>memory
> *)
>    Clear[In, Out];     (* some other things to save 
>memory
> *)
>    Protect[In, Out];   (* some other things to save 
>memory
> *)
>    Get["myPackage`"];(* reload my package *)
>    PackageFunktion[];           (* call my function  *)
>    CleanSlateExcept["Global`"], (* clean my context  *)
>    {i,n}
>    ];

produces the same

PackageFunktion::shdw: "Symbol PackageFunktion appears in
multiple contexts {myPackage`,Global`} definitions in
context myPackage` may shadow or be shadowed by other
definitions."

error.

The second change

> << CleanSlate.m;
> Needs["myPackage`"];
> 
> Do[
>    $HistoryLength = 0; (* some other things to save 
>memory
> *)
>    Unprotect[In, Out]; (* some other things to save 
>memory
> *)
>    Clear[In, Out];     (* some other things to save 
>memory
> *)
>    Protect[In, Out];   (* some other things to save 
>memory
> *)
>    DeclarePackage["myPackage`","PackageFunktion"];
>    PackageFunktion[];           (* call my function  *)
>    CleanSlateExcept["Global`"], (* clean my context  *)
>             (* reload my package *)
>    {i,n}
>    ];
> 

is like my first version. It runs once the loop 
successfully   and does not know the package functions in 
the after the call to ClearSlate.

Matthias



  • Prev by Date: Re: Vector transpose!
  • Next by Date: Creating an application
  • Previous by thread: Re: Loading Packages in a loop
  • Next by thread: Re: Loading Packages in a loop