MathGroup Archive 1995

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

Search the Archive

Save/Get


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


  • Prev by Date: [ ] { } etc on OSF1 LK-401 AG Keyborad
  • Next by Date: Programming
  • Previous by thread: [ ] { } etc on OSF1 LK-401 AG Keyborad
  • Next by thread: Programming