Skip to content

Instantly share code, notes, and snippets.

@ezyang
Created September 29, 2016 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezyang/4c81a64fcbb7dd8d24cd0d6fa6f59dc5 to your computer and use it in GitHub Desktop.
Save ezyang/4c81a64fcbb7dd8d24cd0d6fa6f59dc5 to your computer and use it in GitHub Desktop.

In Backpack, we both typecheck packages with holes (producing only interface files) and compile fully instantiated packages (producing interface files and object files). While doing this, we try to minimize the amount of work the compiler does. In particular:

  1. Any package with holes is typechecked exactly once, in its most general form (with no instantiations). Partially instantiated packages are never typechecked; instead, we just rename the most general interfaces according to the instantiation "on the fly."
  2. Any full instantiation of a package is only compiled once.
  3. To typecheck a package, it's sufficient to have typechecked (not compiled) its dependencies; this lets us avoid waiting to build object code that we aren't actually going to use for typechecking.
  4. However, if we depend on a package without holes, we should go ahead and compile it, because typechecking doesn't tell us anything beyond what compilation (which also typechecks) would.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment