HeadlinesBriefing HeadlinesBriefing.com

Teal: A Statically-Typed Dialect of Lua

Hacker News •
×

Teal is a statically-typed dialect of Lua. It extends Lua with type annotations, allowing developers to specify arrays, maps and records, as well as interfaces, union types and generics. The project aims to fill a niche similar to that of TypeScript in the JavaScript world, while adhering to Lua's spirit of minimalism, portability and embeddability.

Teal is implemented as a compiler, tl, which compiles .tl source code into .lua files. A typical example is a typed function such as local function add(a: number, b: number): number, which returns a + b. Developers can also experiment with the language directly in the browser using the Teal Playground.

The compiler can be installed through LuaRocks with luarocks install tl, and pre-compiled binaries are available for Linux and Windows. For larger projects, the documentation recommends Cyan, a build tool designed for Teal. Editor integrations exist for Visual Studio Code through vscode-teal, and for Neovim and other editors through teal-language-server.

Teal was started by Hisham Muhammad and is developed by a growing group of contributors, and the project itself is written in Teal. Development takes place on GitHub, with discussion available in a community forum and on Matrix. Teal is free and open source software released under the MIT License, the same license as Lua.

Source: Hacker News · Summarized by HeadlinesBriefing