dansalvato / melee-gci-compiler

Melee GCI Compiler is an application and scripting language that makes it easy for Super Smash Bros. Melee mod developers to inject custom code and data into Melee save files.
Mozilla Public License 2.0
34 stars 9 forks source link

Refactor compiler.py to avoid global variables #5

Closed dansalvato closed 2 years ago

dansalvato commented 2 years ago

compiler.py should be refactored so that functions don't modify the state of non-local variables unless they are part of a class.

Possible solutions:

  1. Put most of compiler.py in an encapsulating class so that the functions are modifying its own members, rather than something out of scope
  2. Use a functional approach so that any mutable data belongs to the top-level function, and other functions return a "write table" instead of directly writing to the mutable data
dansalvato commented 2 years ago

Implemented in #6.