# DumpSave and Notation package

 DumpSave[ "~/file.mx",{"*", NotationMakeBoxes, NotationMakeExpression} ]


where it was recommended to not use Block for a DumpSave. This does not work as I get the following error message:

DumpSave["~/file.mx",{Evaluate[Context[]], NotationMakeBoxes, NotationMakeExpression} ]


then I get:

although this IS a context and in fact works, if it is the only argument as in:

 DumpSave["~/file.mx",Evaluate[Context[]]]


Notice that DumpSave has attribute HoldRest which prevents evaluation of all but its first argument.

The documentation of Evaluate states:

• You can use Evaluate to override HoldFirst etc. attributes of built-in functions.

• Evaluate only overrides HoldFirst etc. attributes when it appears directly as the head of the function argument that would otherwise be held.

But in

DumpSave["~/file.mx",{Evaluate[Context[]], NotationMakeBoxes, NotationMakeExpression} ]


Evaluate does not wrap the second argument so it is held unevaluated. Yes, Evaluated does appear in the second argument, but not at its top level (level 0, a.k.a. head of the expression).

Try to use

DumpSave["~/file.mx", Evaluate@{Context[], NotationMakeBoxes, NotationMakeExpression}]


or

With[{context = Context[]},
DumpSave["~/file.mx", {context, NotationMakeBoxes, NotationMakeExpression}]
]

• Thank you very much! Both methods work. Just for clarity, I can understand why the second proposition works, but why does the first work, compared to trying to use Evaluate only on Context? – Patrick.B Feb 3 at 18:05
• Your Evaluate was on the second level of the second argument and the HoldRest attribute of DumpSave prevented scanning of the second level. Try also SetAttributes[f, HoldRest];f[1, {Evaluate@Context[]}] vs.SetAttributes[f, HoldRest];f[1, Evaluate@{Context[]}]. – Henrik Schumacher Feb 3 at 18:07
• You have assumed @Patrick.B knows how Evaluate` works. And without reading its documentation your explanation may be vague. (sorry for being picky but another question was posted that assured me that it is the case) – Kuba Feb 3 at 19:04
• @Kuba Yes, I've seen that other question. I added some more (pun allert!) context. – Henrik Schumacher Feb 3 at 19:11
• Thanks for the patience you are showing to me. I indeed am not aware on the internal mechanism of Evaluate (or just about any built-in functions to be frank). The explanation and examples ended being clear to me in the end though. Thanks again for putting up with me. – Patrick.B Feb 3 at 19:23