fact-project / FACT_js_scripts

trying to refactor Main.js
0 stars 0 forks source link

scripts perform actions on include #2

Open dneise opened 7 years ago

dneise commented 7 years ago

java script has no include as we know, but Thomas has create an include() function in our js interpreter. js code in executed at include time, so stuff can happen on include("my_new_function.js"); if "my_new_fuction.js" does not only implement a function but also calls it right away ... this is extremely hard to understand.

If in addition this function alters some global state, chaos is unavoidable.

Let's try to rewrite all scripts apart from Main.js such that they only implement functions and not call them. (Let's later also try to make sure these functions do not alter global state (too much)).

this is a list of files, we need to check:

dneise commented 7 years ago

Okay, so now all scripts apart from Main.js should have no side effects anymore, and they should only define some functions.

All scripts which had side effects, I moved into Main.js which was possible, none of the side-effect scripts was included more than once.

dneise commented 7 years ago

I would luve, if somebody could review this. The current commit is: https://github.com/fact-project/FACT_js_scripts/tree/bc7f17996b4a515cf3dfca6a633c751d793cd37c