Gerben Wierda schrieb am 23.05.2020 um 15:46:
Just curious: wouldn’t it theoretically be possible to delay opening the output file until the first \stattext? Or is there already stuff going out before that, such as preliminaries that go into the PDF?
\starttext is only a artificial border at the begin of the document and there is nothing which prevents you to put text before it. ConTeXt delays (or resets) a few settings (e.g. loading the default fonts) until this point but the document begins on the first line of the input file. \setupbodyfont[modern-designsize] Page \pagenumber. \page \starttext Page \pagenumber. \stoptext
I think being able to name the output file in the preliminaries in the TeX file would come in handy and prevent more complex workarounds with scripts. But it is not essential as workarounds are possible.
Setting the value of result on the first line is simple because ConTeXt already checks it. Wolfgang