[Docs flaw] Standard-function variables don't work in certain Evaluator code

Demonstration code:

@set foo=123

// Works.
@output:{$foo}.
@output:{=$foo=}.
@output:{=Val("$foo")=}.

// Doesn't work.
=Output($foo + ".")
=Output(Val("$foo") + ".")
@evalalways:Output($foo + ".")
@evalalways:=Output($foo + ".")

I wondered what the problem was. Only when writing all of these options down - accidentally in a revealing order - and seeing that the latter Evaluator outputs were printed first, it dawned on me that these lines will be executed at parse time or between parse time and regular execution time. The docs are misleading in this regard. They just say you can use @set values in Evaluator expressions.

Also, should it be @eval[always]:... or @eval[always]:=...? The docs show both variants in examples: with and without =. What's the difference, and why do both variants exist?

There is no difference; in this case, the = is optional because @eval always expects an evaluator expression. "Classic" modifiers like @hideif support non-evaluator expressions and detect evaluator expressions via =.

1 Like

And this seems to be an Evaluator feature, which makes sense, because the standard-command code would otherwise have to peek into the other domain, which would be hacky. I think these examples, which work, proove that its an Evaluator feature:

@evalalways:= = =  == === === ====== == == = = ==Output("foo")
@output:.{== = =  == === === ====== == == = = =="bar"=}.

This means, the variant without = can be regarded as the default.