Edit: I changed the title and (slightly) the wording of this question in order to make it more easily answerable.
If I evaluate this in Mathematica 9:
SetAttributes[foo, HoldFirst] foo[x_] := (T`var := x; DeleteFile["thisisatest"]; Save["thisisatest", "T`"] ) foo[$ProcessID]
The resulting saved file looks like this:
T`var := $ProcessID $ProcessID = 6903
If I evaluate
Get["thisisatest"], mathematica complains that I shouldn't be setting the value of special symbol
$ProcessID. If I change
DumpSave and try again,
Get no longer triggers the complaint. Examination of the saved file in a text editor shows no evidence of a stored value for
$ProcessID, though it's a little hard to tell.
The behavior I want is that of
DumpSave, but platform independent. The documentation seems to suggest that these two functions would be interchangeable, except that
Save will append to an existing file. What are the known differences between the two functions in practice, and how does one account for them?