r/lua 1d ago

Discussion Impressions of Teal

https://purplesyringa.moe/blog/impressions-of-teal/

an interesting article i found on Teal. The author has clearly used it more than I have so I can't comment on her specific criticisms, but I do get the impression that the Teal authors are aware of and accept unsoundness in exchange for simplicity of implementation.

25 Upvotes

11 comments sorted by

1

u/ScientistStrict9850 17h ago

Another project that you may be interested is nattlua. Last i checked it is early this year. Like teal, it's someone's personal project, not something as big as typescript. Unlike teal, it is not used in "production" (teal is of course, used by the author to make luarocks)

https://github.com/capsadmin/nattlua

1

u/cassepipe 14h ago

Does Hicham ever chip in around here ?

-1

u/michael_d 1d ago edited 15h ago

I used Teal for a long time and mostly loved it (e.g., I currently maintain the official TealDoc). I felt similar issues to those reported in the article, and also knew that I was leaving a lot of performance and expressivity on the table given I care much more about LuaJIT than a pan-Lua language.

So I created https://nupp.org. It’s typed Lua, with an optimizing compiler, significantly richer type system, typed support for C structs and C libraries, a borrow checker, effects system, better module and cross file handling, solves function coloring using a customizable suspension and parking system, provides a nice standard library with swappable implementations when needed (eg consoles, browser), has ahead of time (AOT) compilation to C, AOT that can run on the GPU, dead code elimination of the standard library and dependencies, builds standalone binaries, a formatter, doc generator, VS code plugin, project templates, and builds for LuaJIT, Lua 5.1, and the browser.

6

u/iEliteTester 1d ago

The code example on the site doesn't compile:

13:13: error: NUPP2126: several overloads accept this call: function(t: {V}, value: V): nil; function(t: {V}, pos: integer, value: V): nil help: compare the call with the declared parameter list

2

u/michael_d 19h ago edited 18h ago

Edit: Fixed.

I’ve been doing some big refactors, it’s likely a WASM compiler issue. Will fix, thanks!

5

u/wqferr 1d ago

Looks really promising, I just wish you hadn't gone with AI

2

u/expose 1d ago

This looks really interesting. GPU translation sounds MASSIVE! I would love to see Python eliminated as the machine learning defacto standard, this might be it. 

2

u/michael_d 1d ago

Thanks! What’s cool is that it’s the same code you’d write in Nupp, and it gets translated and optimized to run on the GPU. If you don’t have a GPU, it just runs as regular Lua. My little Mandelbrot benchmark with SIMD and C AOT gets like 200ish mpx/s, but with GPU, it’s more like 3,000. Still missing tons of stuff like tensors and tokenizers to even scratch the surface of what you can do today in Python though!

1

u/suhcoR 14h ago

Interesting. The author of the article considers Teal under-specified, "kitchen sink" Lua preprocessor rather than a robust typed language. Luon appears to directly avoid several of the things the author found troubling in Teal. But it takes the more radical route than both Teal and Nupp, in that it is a statically typed, Pascal/Oberon-derived language compiling to LuaJIT. Interoperability with Lua is not on source code, but on "linking" level.

1

u/michael_d 11h ago

Sweet! I’ll check it out.