Skip to content

prepoly

A statically type-checked scripting language that requires only minimal type annotations and compiles programs just in time.

The name prepoly comes from pre-typed and polymorphic. prepoly is a scripting language: you run a source file directly, with no build step. Under the hood it JIT-compiles your programs as it runs them and checks types just before each function is executed, so you don’t wait for compilation but still get the full benefit of static type checking.

prepoly’s type system is built on flexible type inference, which reduces the burden of writing type annotations to nearly zero. You can still add annotations explicitly to constrain the types of variables when you want to.

Features are summarized as follows:

  • Just-in-time compilation
  • Per-function type checking, performed just before each function runs
  • Type inference for most types, resolved at execution time
  • Structural subtyping with interface definitions

This book is organized in two parts: the user guide introduces the language feature by feature, with runnable examples, and the references describe the language exhaustively — the exact syntax, the type system rules, the standard library, and the execution model.