Save/Get
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1717] Save/Get
- From: Martin Rickli <Rickli at aut.ee.ethz.ch>
- Date: Thu, 20 Jul 1995 22:36:33 -0400
- Organization: Automatic Control Laboratory, ETH Zurich
Hi
Have you ever tried to save a protected symbol to a file and reload it
using Get? Unfortunately the sequence in which Mathematica writes
definitions to the file is - in above mentioned case - wrong: First the
protected attribute is saved and then other definitions. When you try to
reload you get a bunch of error messages (symbol protected)!
How about changing the order definitions are saved to file?
======================================================
In[33]:=
test[x_] = x^2;
Protect[test]
Out[34]=
{test}
In[35]:=
Save["xxx", test]
In[36]:=
!!xxx
Attributes[test] = {Protected}
test[x_] = x^2
In[37]:=
Unprotect[test]
Remove[test]
Out[37]=
{test}
In[39]:=
Get["xxx"]
From In[39]:=
Set::write: Tag test in test[x_] is Protected.
Out[39]=
2
x
In[40]:=
??test
Global`test
Attributes[test] = {Protected}
======================================================
Your opinions are welcome.
Regards
Martin Rickli