Live data from Hacker News

Teal – A statically-typed dialect of Lua

teal-language.org

61–70 of 176 posts

Re: Teal – A statically-typed dialect of Lua

#61
I really want to like Lua but I just can’t. Tried Lua/Fennel/even Teal but I just can’t.

I can’t tell what it is exactly. Maybe those weird global rules? Maybe inspection of objects and metatables? Maybe the weird mix of verbose and not verbose (e.g. getting output of a process requiring popen and manual handling but then function can take more arguments than declared and whateva) or exotic control flow and structures (metatable, global env).

It’s interesting language, but I just grit my teeth every time I’m interacting with it.

Re: Teal – A statically-typed dialect of Lua

#62
There's a type declaration file for the vim global that's defined by default in Neovim: https://github.com/teal-language/teal-types/blob/master/type...

to be used via `global_env_def` described in https://teal-language.org/book/declaration_files.html

And though they mention it as being for third party libraries, this also seems a way to declare types for your own code in an external file, thus keeping your code as runnable Lua and benefiting from type checking too. That seems like a neat workflow for developing Neovim plugins with this: instead of having to constantly regenerate Lua from .tl files so Neovim can pick up your changes during development.

Edit: or maybe https://github.com/teal-language/tl#loading-teal-code-from-l... this is the easier way to do it. `require` and use `loader` during development, generate the Lua once things are somewhat stable.

Re: Teal – A statically-typed dialect of Lua

#63

There's a type declaration file for the vim global that's defined by default in Neovim: https://github.com/teal-language/teal-types/blob/master/type... to be used via `global_env_def` described in https://teal-language.org/book/declaration_files.html And though they mention it as being for third party libraries, this also seems a way to declare types for your own code in an external file, thus keeping your code as ru…

> this also seems a way to declare types for your own code in an external file, thus keeping your code as runnable Lua and benefiting from type checking too

The declaration file isn't used to typecheck the code the declaration is for. It is only for consumers of the code.

Re: Teal – A statically-typed dialect of Lua

#64
I tried it for one project, but converted it to TypeScript-to-Lua instead.

I used Lua on the backend and my frontend was already in TypeScript, so it was nice that I could reuse the backend types without conversion in the frontend.

Re: Teal – A statically-typed dialect of Lua

#65

There's a type declaration file for the vim global that's defined by default in Neovim: https://github.com/teal-language/teal-types/blob/master/type... to be used via `global_env_def` described in https://teal-language.org/book/declaration_files.html And though they mention it as being for third party libraries, this also seems a way to declare types for your own code in an external file, thus keeping your code as ru…

> this also seems a way to declare types for your own code in an external file, thus keeping your code as runnable Lua and benefiting from type checking too The declaration file isn't used to typecheck the code the declaration is for. It is only for consumers of the code.

Ah that's a shame. I was hoping it would work via sidecar files like Ruby's RBS [1] or Python's stub files [2]

I was editing my comment during your reply, and added this:

> or maybe https://github.com/teal-language/tl#loading-teal-code-from-l... this is the easier way to do it. `require` and use `loader` during development, generate the Lua once things are somewhat stable.

Does that sound like the right idea then?

[1] https://github.com/ruby/rbs [2] https://mypy.readthedocs.io/en/stable/stubs.html

Re: Teal – A statically-typed dialect of Lua

#66
post #10
post #7

Earlier quoted context omitted.

I vote we give the name to the lua one!

Seconded.

I think you and GP both mean that this TEAL is adjacent to crptocurrency, and therefore, who cares about stepping on toes?

This heuristic works well in most cases maybe, but will lead to false positives sometimes. May I gently suggest that this might be one of those cases. Algorand is the project of this fellow

https://en.m.wikipedia.org/wiki/Silvio_Micali

Credentials aren't faultless but they do provide a certain web of trust. If you browse the academic and professional history of this fellow, I think you'll agree.

Algorand is, I think, as serious and sincere a research project as any other.

Re: Teal – A statically-typed dialect of Lua

#67
post #61

I really want to like Lua but I just can’t. Tried Lua/Fennel/even Teal but I just can’t. I can’t tell what it is exactly. Maybe those weird global rules? Maybe inspection of objects and metatables? Maybe the weird mix of verbose and not verbose (e.g. getting output of a process requiring popen and manual handling but then function can take more arguments than declared and whateva) or exotic control flow and structure…

[deleted]

Re: Teal – A statically-typed dialect of Lua

#68
post #59

Earlier quoted context omitted.

I don't think it's a good language, and I hate it. I've made thousands of the same mistakes with it—typing . instead of :. There's a reason Lua has a smaller audience than assembly.

> There's a reason Lua has a smaller audience than assembly. I don't think that's true. It's a very embedded language. Its use in video games and video game modding alone would outnumber the number of people directly writing assembly to achieve things.

Or the number of routers that are using it, or other deployable hardware...

Re: Teal – A statically-typed dialect of Lua

#69

I've been diving into Lua (a little late to this party, but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash, especially with LLM assistance!) and it's really something of an eye-opener. LuaJITted Lua code runs at 80% (on average, sometimes faster!) of the compiled C version of the same algorithm , typically. Lua is embedded in a surprisingly massive numbe…

Any recommendations going from bash to lua to watch out for except indexing?

Re: Teal – A statically-typed dialect of Lua

#70

I've been diving into Lua (a little late to this party, but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash, especially with LLM assistance!) and it's really something of an eye-opener. LuaJITted Lua code runs at 80% (on average, sometimes faster!) of the compiled C version of the same algorithm , typically. Lua is embedded in a surprisingly massive numbe…

It is true that LuaJIT is stuck at 5.1, but you could write any performance critical sections in C/C++ and call it from Lua. Lack of LuaJIT for 5.1+ isn't that big of a deal for desktop apps. The embedded world is still stuck in 5.1, but for them, the benefits of the latest Lua is marginal.

And despite it being stuck at 5.1, it still implements features from other versions. For example, there is the "LJ_52" macro, so you can compile "table.pack" and "table.unpack" into LuaJIT, which I do, because I use both at times.

As someone else have pointed it out, they are cherry picked: https://luajit.org/extensions.html.

Post reply on HN