3 stable releases

Uses old Rust 2015

1.1.0 Jul 18, 2017
1.0.5 Jun 1, 2017
1.0.4 Apr 25, 2017

#7 in #kailua


Used in 4 crates (2 directly)

MIT/Apache

310KB
6K SLoC

Type system for Kailua.

The Kailua type system is in principle a Hindler-Milner type system with significant extension for subtyping, gradual typing and row polymorphism. The "in principle" qualification is there because there are (unfortunately) several known discrepancies, but they are at least considered (low-priority) bugs. Naturally, the full type inference is not supported (which is even more undesirable when we want records, arrays and maps not freely convertible to each other anyway).

Two defining aspects of the Kailua type system are that nil is not checked and that (inextensible) records may still contain unknown labels. This is a result of making the type system usable without breaking Lua compatibility; it is quite comparable to the type system of TypeScript 1.x. The type system does have types for not allowing nil or accesses to unknown labels, but they exist mostly to avoid mistakes and not to make the type system sound.

Generics are planned but not yet implemented; this is probably the biggest missing type system feature. Many recursive types are not properly checked too, which requires proper occurs check that the type system still doesn't implement (ugh).

Dependencies

~5MB
~99K SLoC