I knew Luarocks existed, had no idea Teal did, for a second I wondered how this compared to Terra, then realized this is more TypeScript for Lua (which is fine).
It seems like type hints are good for any dynamic language, since they wind up in most of them overall.
For all (most?) intents and purposes, Fennel is lisp-language, not just lisp-y. It's Clojure-y if anything, which makes sense considering the creator of Fennel.
They both have type systems and such. The comparison doesn't have to be about the compilation/transpilation process, but the developer experience is still important.
Hisham is one of the key devs there. He started GoboLinux, htop and some more.
Personally I am not the biggest fan of lua as it really is such a light language in every sense of the word (meaning, syntax too and features - too light IMO). But it's good that creativity keeps pushing things forward.
Being light in every sense of the word is a primary feature of the language.
Lua is great for high-level control of a program written in C/C++. When setting that up, I’ve often appreciated that I could removed features like file I/O from the Lua standard library and the rest keeps on trucking.
Lua is terrible for writing programs by itself. People keep trying to make it happen. But, for anything non-trivial, it’s a fool’s errand.
As someone who wrote entire stacks and apps on top in LuaJIT that I got paid for and are running without any problems after many years, this is getting a little tiresome to hear.
I had no idea that GoboLinux and htop were made by the same dev, let alone Teal. I can sort of see why someone who preferred to keep things simple and straightforward in a way that would lead to GoboLinux would also be involved in something directly related to Lua.
As for how light it is, I don't disagree with you that it's frustrating, but as someone who only started using it at the beginning of last year for making a mod, I've realized that in a lot of ways, it feels like it's JavaScript if it were designed properly from the start. Both use a single map data structure for everything, including having arrays be "maps with incrementing integer keys", but Lua anticipated that iteration for arrays should work differently made the loop syntax give you a way to specify which way you want. Neither has a particularly large set of APIs that are available out of the box, but Lua defined a module system from day one (I assume, I guess I don't know for sure) and even provides a way to use it as for defining objects; JavaScript has a prototypical inheritance system that's probably more complex than it ever needed to be, and it took decades for a standard way of importing things to be defined. Lua also doesn't have the famous warts of implicit type coercion for operators (including the more familiar looking of the two equality checks); I'd take arrays starting at 1 over that any day.
I don't love working in Lua, but given how unfathomable it is to me that so many people genuinely seem to enjoy JavaScript, Lua seems more than sufficient in terms of the language features at least.
I find that in practice the amount of +-1 is about the same for zero-based and one-based indexing. Each has situations it is better suited for. For example, iterating a list backwards is nicer with one-based indexes.
These days all you gotta do is ask your local LLM to write you a Lua with 0-based indexing. Sure beats complaining about 1-based indexing on HN until the end of time.
Observation: Teal would make a great scripting language for a simpler web browser, one not based on JavaScript... maybe something like the 'Surf' web browser: (https://surf.suckless.org/).
Also, there should exist the capability to compile Teal to Wasm... or at least Teal to Lua to Wasm(!)... to that end, there exists the following GitHub repo (but I'm not sure if it's 100% operational yet):
I ported a mod I made to Teal when adding a feature was taking me way too long in regular Lua to get working correctly (I freely admit that I'm seriously crippled in my ability to write correct algorithms without being able to define types that I can enforce). This was before I had ever tried to use an LLM to code before.
Now that LLMs are a common thing for coding, modding communities (which in practice have a large number of people using Lua since quite a lot of the most widely modded games use Lua for mods) are having to adapt a bit to handle the influx of a huge number of mods from people who have never programmed before, which I tend to view as a good thing in the long run, but right now LLMs seem to be rather abysmal at writing reasonable Lua. There's a meme (in the original sense of the word) that you can tell when a mod is LLM generated because it will use pcall in ridiculous ways, seemingly because it's a lot quicker to abuse it as a retroactive control flow mechanism than to go back and add proper checks up front (and probably restructure the code in the process). Teal doesn't fully solve the underlying issue of LLMs apparently being very poorly trained on Lua but it does at least give a pretty good way of statically enforcing what the actual types it should be using are.
Not all programming languages are equal. Some are easier to review, some are faster, different ecosystems, different target architectures, many reasons.
That's like someone saying "What is the purpose of x64 in the new age of C?" back in 1999.
What difference does AI make? Teal simply gives you the option to add static types to your Lua code, to enable additional compile-time correctness checks.
Surely that’s useful, no matter whether you’re writing the code yourself or having an agent do it.
The main thing is getting feedback. I've been doing some intense agent iteration on Lua projects, and so long as the error output is clear and it's easy for the harness to restart/inspect/stream logs it seems to do very well with Lua
In fact, I'd say it's more "fun" watching an agent work on something in Lua as the iteration loop is tighter: more restarts, more feedback, instant running. When I deal with typed languages (in my case, Swift) the feedback loop is dragged-out by the compile time which makes the whole process feel slower
Controversial opinion, but new programming languages are desperately needed, _especially_ in the age of LLMs. Simply put, not all languages provide equal expressiveness, even if they're all Turing complete.
Not only that, but the most important thing that a programming language does from an expressiveness perspective is define what your can't do. I often like to say that when there are an infinite number of programs you could write, programming is the act of narrowing that space until you're left with one program that you did write. Bugs are deviations from the one you were targeting, and a programming language can dramatically improve the process by eliminating a lot of the ones you don't want up front (ideally ones that might be easy to accidentally hit instead of your target)
that's not controversial to me. Programming languages that prioritize LLM creation/editing/reasons over it, while making it easy for humans to review and edit, but not being the primary author of the literal code.
Learning a new programming language and getting good at it is extermely satisfying. I get no satisfaction out of AI writing code I dont understand, its quite the opposite actually.
It will be people who understand things and experiment still that will succeed in the world of AI. People who are meat proxies are screwed its already making you lazy and probably giving your brain a disease we haven't named yet, a type 2 diabetes-esque of the brain.
A good example of a large Teal codebase is Luarocks, the Lua package manager: https://github.com/luarocks/luarocks/tree/main/src/luarocks
I knew Luarocks existed, had no idea Teal did, for a second I wondered how this compared to Terra, then realized this is more TypeScript for Lua (which is fine).
It seems like type hints are good for any dynamic language, since they wind up in most of them overall.
I'm curious if there is a comparison to Luau.
This is a transpiler. Luau is a completely different language and runtime.
It’s part of the big three Lua syntax flavours: Teal (Typescript-y), Fennel (Lisp-y), Moonscript (Ruby-ish)
There is another one, which is not a transpiler: https://github.com/rochus-keller/luon
> Fennel (Lisp-y),
For all (most?) intents and purposes, Fennel is lisp-language, not just lisp-y. It's Clojure-y if anything, which makes sense considering the creator of Fennel.
3 replies →
> (Ruby-ish)
Thanks for the chuckle.
They both have type systems and such. The comparison doesn't have to be about the compilation/transpilation process, but the developer experience is still important.
1 reply →
How many statically-typed dialects of Lua are there anyway? I know there is Terra. There was also... Sol, I think? Anything else?
How are we supposed to keep up with the sheer volume of cool note-worthy tools coming out. This is getting out of hand
Well for starters Teal is at least six or seven years old
Important info really
The Algernon web server comes with built-in support for Teal.
Hisham is one of the key devs there. He started GoboLinux, htop and some more.
Personally I am not the biggest fan of lua as it really is such a light language in every sense of the word (meaning, syntax too and features - too light IMO). But it's good that creativity keeps pushing things forward.
Being light in every sense of the word is a primary feature of the language.
Lua is great for high-level control of a program written in C/C++. When setting that up, I’ve often appreciated that I could removed features like file I/O from the Lua standard library and the rest keeps on trucking.
Lua is terrible for writing programs by itself. People keep trying to make it happen. But, for anything non-trivial, it’s a fool’s errand.
As someone who wrote entire stacks and apps on top in LuaJIT that I got paid for and are running without any problems after many years, this is getting a little tiresome to hear.
2 replies →
I had no idea that GoboLinux and htop were made by the same dev, let alone Teal. I can sort of see why someone who preferred to keep things simple and straightforward in a way that would lead to GoboLinux would also be involved in something directly related to Lua.
As for how light it is, I don't disagree with you that it's frustrating, but as someone who only started using it at the beginning of last year for making a mod, I've realized that in a lot of ways, it feels like it's JavaScript if it were designed properly from the start. Both use a single map data structure for everything, including having arrays be "maps with incrementing integer keys", but Lua anticipated that iteration for arrays should work differently made the loop syntax give you a way to specify which way you want. Neither has a particularly large set of APIs that are available out of the box, but Lua defined a module system from day one (I assume, I guess I don't know for sure) and even provides a way to use it as for defining objects; JavaScript has a prototypical inheritance system that's probably more complex than it ever needed to be, and it took decades for a standard way of importing things to be defined. Lua also doesn't have the famous warts of implicit type coercion for operators (including the more familiar looking of the two equality checks); I'd take arrays starting at 1 over that any day.
I don't love working in Lua, but given how unfathomable it is to me that so many people genuinely seem to enjoy JavaScript, Lua seems more than sufficient in terms of the language features at least.
musl + lua + c library + all lua codes can produce single static binary for linux which I utilize a lot.
I still remember when static linking was the only option compilers would give us.
Some of them had this cool modern idea of overlays, where we would manually manage loading additional code segments into the same process memory slot.
How well does Lua plug into Rust libraries? Also how good is Lua for UIs?
1 reply →
Lua's 1-based inclusive indexing makes math so annoying. Plus- and minus-one everywhere.
I find that in practice the amount of +-1 is about the same for zero-based and one-based indexing. Each has situations it is better suited for. For example, iterating a list backwards is nicer with one-based indexes.
1 reply →
That is absolutely not the case.
Numerical loops in Lua are inclusive:
On the example above the i starts at 1 and goes up to (and including) the length of t.
With 0-based indexes, and that numerical loop format, it would be minus-one everywhere:
1 reply →
These days all you gotta do is ask your local LLM to write you a Lua with 0-based indexing. Sure beats complaining about 1-based indexing on HN until the end of time.
1 reply →
Observation: Teal would make a great scripting language for a simpler web browser, one not based on JavaScript... maybe something like the 'Surf' web browser: (https://surf.suckless.org/).
Also, there should exist the capability to compile Teal to Wasm... or at least Teal to Lua to Wasm(!)... to that end, there exists the following GitHub repo (but I'm not sure if it's 100% operational yet):
https://github.com/ysugimoto/webassembly-lua
[flagged]
1. Teal has been around since before LLMs were good at coding [0].
2. I don't see anything wrong with coding for purely artistic purposes?
3. Presumably a static type checker would be quite helpful for LLMs, since it would help them catch lots of their mistakes.
[0]: https://github.com/teal-language/tl/blob/main/CHANGELOG.md#0...
I ported a mod I made to Teal when adding a feature was taking me way too long in regular Lua to get working correctly (I freely admit that I'm seriously crippled in my ability to write correct algorithms without being able to define types that I can enforce). This was before I had ever tried to use an LLM to code before.
Now that LLMs are a common thing for coding, modding communities (which in practice have a large number of people using Lua since quite a lot of the most widely modded games use Lua for mods) are having to adapt a bit to handle the influx of a huge number of mods from people who have never programmed before, which I tend to view as a good thing in the long run, but right now LLMs seem to be rather abysmal at writing reasonable Lua. There's a meme (in the original sense of the word) that you can tell when a mod is LLM generated because it will use pcall in ridiculous ways, seemingly because it's a lot quicker to abuse it as a retroactive control flow mechanism than to go back and add proper checks up front (and probably restructure the code in the process). Teal doesn't fully solve the underlying issue of LLMs apparently being very poorly trained on Lua but it does at least give a pretty good way of statically enforcing what the actual types it should be using are.
Not all programming languages are equal. Some are easier to review, some are faster, different ecosystems, different target architectures, many reasons.
That's like someone saying "What is the purpose of x64 in the new age of C?" back in 1999.
What is your purpose in the new age of AI?
Probably half ass web platforms nobody uses.
Burn!
so true
What is the purpose of gcc in the new age of AI? Can't you ask your agent to build a compiler if you want to run Hello World?
Can't you ask your agent to spit out binary in the first place?
What difference does AI make? Teal simply gives you the option to add static types to your Lua code, to enable additional compile-time correctness checks.
Surely that’s useful, no matter whether you’re writing the code yourself or having an agent do it.
Right? It's not like as soon as LLM coding became a common thing everyone who was using TypeScript threw it out and went back to vanilla JS.
Not everyone uses AI though. Some do, some don't. I don't.
Though, I am not really in the lua camp either. But I had to comment on the "only AI counts" transfigurative statement.
AI works much better when it gets immediate feedback from a good type checker
The main thing is getting feedback. I've been doing some intense agent iteration on Lua projects, and so long as the error output is clear and it's easy for the harness to restart/inspect/stream logs it seems to do very well with Lua
In fact, I'd say it's more "fun" watching an agent work on something in Lua as the iteration loop is tighter: more restarts, more feedback, instant running. When I deal with typed languages (in my case, Swift) the feedback loop is dragged-out by the compile time which makes the whole process feel slower
2 replies →
Programming languages are useful?
Controversial opinion, but new programming languages are desperately needed, _especially_ in the age of LLMs. Simply put, not all languages provide equal expressiveness, even if they're all Turing complete.
Not only that, but the most important thing that a programming language does from an expressiveness perspective is define what your can't do. I often like to say that when there are an infinite number of programs you could write, programming is the act of narrowing that space until you're left with one program that you did write. Bugs are deviations from the one you were targeting, and a programming language can dramatically improve the process by eliminating a lot of the ones you don't want up front (ideally ones that might be easy to accidentally hit instead of your target)
3 replies →
that's not controversial to me. Programming languages that prioritize LLM creation/editing/reasons over it, while making it easy for humans to review and edit, but not being the primary author of the literal code.
Teal isn't particularly new. First commit is Jan 2019
one needs an internet connection and a huge amount of energy to run, the other doesnt
I agree with this sentiment.
LLMs are already so incredibly capable and will only get better and faster with time.
Learning a new programming language just feels redundant now.
Learning a new programming language and getting good at it is extermely satisfying. I get no satisfaction out of AI writing code I dont understand, its quite the opposite actually.
It will be people who understand things and experiment still that will succeed in the world of AI. People who are meat proxies are screwed its already making you lazy and probably giving your brain a disease we haven't named yet, a type 2 diabetes-esque of the brain.
vibes2wasm
Yoooo