Typed Lua

Some random thoughts and ideas about types

1. Preface

We outline a method to extend the TypeScript system to Lua. However, as TypeScript's subtype semantics do not satisfy completeness (only soundness), we emphasize a method for subtyping that is both sound and complete.

...

2. Subtyping using operators

In this section, we develop just enough definitions to aid in the implementation of such a system. We will define precisely what it means to be a subtype and show informally that our definition is sensible (i.e., it is consistent with basic subtype rules).

Proof

First:

Second: Proceed similarly to above.​

Proof

First:

Second: Proceed similarly to above.​

Proof

Remark: This is an important result and shows that function parameters are contravariant while function return types are covariant.

Proof

We will not develop these theorems further.

3. Subtyping as a SAT problem

4. ​Implementation

5. Further work and limitations

Last updated