So,
I have spent some time and have modules compiling. I chose to use a
command line flag for pyjs.py and allow the previous functionality to
remain unchanged. You have to specify that you want pyjs to compile
as modules. I made sure that all tests still pass (on Windows) after
my modifications.
I did not see anywhere that pyjaco.append_module was being used for so
I started my changes here.
I have two tests that run under "tests/as_module/simple/". Once you
run the test you will see a file that ends with .run. That is the
javascript file that causes the js code to run. It uses the
$PY.run_module function I added to builtins.
I decided that it would be best to pass modules a reference to the
__builtins__ module. This will allow us to modify the pyjaco
namespace without needing to update any compiled code and it just
feels cleaner than reaching for a global __builtins__ object. The
code could still fallback to the global __builtins__ object if
wanted. I think it would be best if there was only one global
javascript object used for pyjaco in the future.
The run_module function also sets __name__ so that "if __name__ ==
'__main__'" initialization can be used.
Anyways, I was hoping for some feedback/thoughts.
Thanks,
Gordon