Is there a way to set what symbols's definitions I do not want to store?
Consider the following code:
f := $MachineID;
SetDirectory[NotebookDirectory[]];
Save["testm.m", f];
ClearAll@f
<< "testm.m"
f
Set::specset: Cannot change the value of special symbol $MachineID. >> 0000-00000-00001 (*id of storing machine*) 0000-00000-00002 (*id of getting machine*)
This happens bacause testm.m contains:
f := $MachineID $MachineID = "0000-00000-00001"
Questions:
Is there nicer way to avoid this than my approach:
f:= Symbol["MachineID"]?
Is it
Protectedattribute which decides what is going to be stored? Because there is no problem iff:=SystemIDbut:Attributes[{$SystemID, $MachineID}]{{Locked, Protected}, {}}
Edit:
- Why
MachineIDis not protected? - The bounty is founded for this question.
$MachineIDis notProtected– Jacob Akkerboom Aug 27 '13 at 11:42DynamicModules andManipulates. I have this issue with$MachineIDand$UserName. – Gustavo Delfino Jul 24 '17 at 14:18SaveDefinitions, it is nice for small cases but in general I work with: https://mathematica.stackexchange.com/a/86707/5478 – Kuba Jul 24 '17 at 14:39