# Difference between $Context and Evaluate[Context[]] using DumpSave If I were to type both individually with // FullForm, It would seem that both are the same: However, in the context for example of a dumpsave: DumpSave["~/Documents/test.mx",$Context]

DumpSave["~/Documents/test2.mx", Evaluate[Context[]]]


it would seem that the latter works as expected while the former does not. Why is that?

• I want to save all the symbols that have been defined in the current context. The latter does exactly that, while the former just does not do anything at all. – Patrick.B Feb 3 '19 at 19:03
• The difference is that $Context does not get evaluated because DumpSave has the attribute HoldRest (see here for details). DumpSave["~/Documents/test.mx", Evaluate@$Context] works. – Henrik Schumacher Feb 3 '19 at 19:14

There are several issues. First of all Context[] is the same here and can be replaced with $Context to make the example clearer. Now: 1. DumpSave is HoldRest so in case of symbol = 2 it can save that definition instead of seeing 2. 2. DumpSave["file", symbol] will save defnitions of symbol. So will DumpSave["file",$Context]. It will save information that $Context = whateverthecontextthereis. If you want to DumpSave["file", "Global"] you need to explicitly write it or inject it before DumpSave is evaluated. Those are most common ways to do this: Function[x, DumpSave["file", x]] @$Context
DumpSave["file", #]& @ $Context DumpSave["file", Evaluate @$Context]
With[{ x = $Context }, DumpSave["file", x] ]  In your recent question you had DumpSave["file", { Evaluate @$Context }]. It didn't work because Evaluate only works on the first level of an expression that has Hold* attribute. This expression here is DumpSave but on the first level it has a string and a list so evaluator does not care about Evaluate`.