[texworks] SCRIPTING: readFile() xxxGlobal() and NewFile hook

Stefan Löffler st.loeffler at gmail.com
Mon Dec 20 16:09:22 CET 2010


Hi,

On 2010-12-20 03:42, Paul A Norman wrote:
> Seems TW.app.setGlobal("xxx",Xxx);  just nicely overwrites itself if
> called again (an update), any possible issues with calling it
> identically in same session please?

You mean something like
    TW.app.setGlobal("xxx",1);
    TW.app.setGlobal("xxx",2);
    TW.app.setGlobal("xxx",3);
?

No, there shouldn't be any issues. In the end of such a script, "xxx"
should have the value 3.


> Some interesting possibilities open up for simplifying scripting ...

Indeed. Please keep in mind, though, that this was intended primarily
for passing values between script invocations. It was not intended as
large-scale storage. This means, if a user installs, say, 10 scripts
(probably of different authors) which all load the same, say, 10 MB of
helper functions, frameworks, etc., this will result in
a) Loading 100 MB from disk at startup, thereby possibly slowing it down
considerably
b) An increased memory footprint of > 100 MB (depending on how
efficiently the data is stored by Qt), again possibly causing
performance issues.

I'm not saying it can't be done, I'm not even saying it shouldn't be
done. I'm just saying: be careful with what you're doing ;).

HTH
Stefan


More information about the texworks mailing list