New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor script-import system to allow pre-compilation without execution #437

Open
lihaoyi opened this Issue Aug 17, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@lihaoyi
Copy link
Owner

lihaoyi commented Aug 17, 2016

Currently, if you have multiple files, A.sc importing B.sc importing C.sc, the control flow is depth first: A triggers processModule on B, triggers processModule on C, and they then evaluate in reverse: C then B then A.

This workflow provides flexibility: e.g. if you dynamically interp.load.ivy inside B, you can use the results in A. In exchange, this design doesn't allow you to compile A before executing B, which makes "pre-compiling" a dependency-graph of scripts to check for basic correctness impossible.

A different way of doing this could be to resolve only the import hooks first, without compilation or execution, and then perform compilation of all dependent scripts after, and then execute everything at once.

That advantage of the alternate design is that it will let us resolve A B and C all at once, and compile everything to check for correctness without running the script locally. That would be a good step up in correctness, e.g. if you want to type-check your deployment scripts locally but only run them later in the deployment environment.

It would likely also result in a compilation speedup, since it would avoid the overhead the overhead of starting lots of compilation runs for each individual file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment