Live data from Hacker News

Teal – A statically-typed dialect of Lua

teal-language.org

141–150 of 176 posts

Re: Teal – A statically-typed dialect of Lua

#141
post #94

Earlier quoted context omitted.

In reality, tables are used in specific fashions and not fully generally. (Partly because Lua itself even recognizes some of these fashions and provides relevant operations accordingly.) Lua tables are not really a single data structure; it is a single type that acts as multiple data structures at once.

Yeah Lua optimizes array tables for performance as long as they're arrays. That's the only optimization I'm aware of. I get why they didn't just add arrays, to keep the syntax and semantics clean, simple, and unambiguous. I just don't like it. If you take that to its extreme, you get Lisp. Natural human languages are messy and full of warts, but they work despite that, or perhaps because of that, because human life i…

More than just keeping it simple, it's also about reducing the API surface of the language. Lua's main design constraint is that it's meant to be embedded inside other applications, and the versatile table type helps a lot in that regard.

Re: Teal – A statically-typed dialect of Lua

#142

Earlier quoted context omitted.

One of Lua's goals has been extreme portability, and the main implementation works on anything that has a C compiler, going to the extreme of compiling cleanly on C89, C99, and even compiling as C++ (no extern "C"). Remember that Lua is popular in the embedded space too, so this is a big feature. Pallene isn't designed to be a new native language on its own. Pallene is designed to be a companion language for Lua, spe…

That's actually really exciting in that case. If it goes further and generates native C control flow statements when possible ("if", "for", native functions, native function calls, etc), I think it could be an omni-level language, generating basically Lua statements when dynamic and C when not, and mixing them all within the same program, entirely controlled by how much type information you give it (and how you use t…

Alas, as of last month we changed Pallene's compiler and it now generates C gotos for control flow. ( ^ _ ^ メ ) It helped with certain optimizations...

Re: Teal – A statically-typed dialect of Lua

#143
post #140

Earlier quoted context omitted.

One of Lua's goals has been extreme portability, and the main implementation works on anything that has a C compiler, going to the extreme of compiling cleanly on C89, C99, and even compiling as C++ (no extern "C"). Remember that Lua is popular in the embedded space too, so this is a big feature. Pallene isn't designed to be a new native language on its own. Pallene is designed to be a companion language for Lua, spe…

I'm Pallene's lead maintainer. Currently the code is maintained by me, my students and other open sou rce collaborators. We collaborate with Roberto over some Pallene-related research, specially about the type system semantics, but he isn't an active committer.

That's really exciting work. Great job. Hope it's fulfilling.

Re: Teal – A statically-typed dialect of Lua

#144
post #10

Earlier quoted context omitted.

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 we…

nothing against Algorand, there's just a kind of nice fuzzy feeling that lua gives me. Plus the name is a good pun

Re: Teal – A statically-typed dialect of Lua

#145

Years ago, I tried lua and wasn't impressed. Then I started using Neovim, did the necessary configuration in lua, but continued writing my own scripts in vimscript. Later I started using wezterm and decided to give lua a second shot, and I began to really like it. I realized my initial dislike for lua stemmed from my experience with javascript (back in the jwquery days), where maintaining large codebases felt like na…

> That being said, lua's lack of popularity probably stems from its limited stdlib, which often feels incomplete, and the absence of a robust package manager. luarocks is a pain to work with.

And indexing arrays starting from 1 rather than 0.

Re: Teal – A statically-typed dialect of Lua

#147
post #145

Years ago, I tried lua and wasn't impressed. Then I started using Neovim, did the necessary configuration in lua, but continued writing my own scripts in vimscript. Later I started using wezterm and decided to give lua a second shot, and I began to really like it. I realized my initial dislike for lua stemmed from my experience with javascript (back in the jwquery days), where maintaining large codebases felt like na…

> That being said, lua's lack of popularity probably stems from its limited stdlib, which often feels incomplete, and the absence of a robust package manager. luarocks is a pain to work with. And indexing arrays starting from 1 rather than 0.

It doesn't "index arrays from 1", it doesn't have arrays, but tables, that can operate as "sequences". It's all documented in the docs.

>>> A table with exactly one border is called a sequence. For instance, the table {10, 20, 30, 40, 50} is a sequence, as it has only one border (5). The table {10, 20, 30, nil, 50} has two borders (3 and 5), and therefore it is not a sequence. (The nil at index 4 is called a hole.) The table {nil, 20, 30, nil, nil, 60, nil} has three borders (0, 3, and 6) and three holes (at indices 1, 4, and 5), so it is not a sequence, too. The table {} is a sequence with border 0. Note that non-natural keys do not interfere with whether a table is a sequence

Re: Teal – A statically-typed dialect of Lua

#148
post #142

Earlier quoted context omitted.

That's actually really exciting in that case. If it goes further and generates native C control flow statements when possible ("if", "for", native functions, native function calls, etc), I think it could be an omni-level language, generating basically Lua statements when dynamic and C when not, and mixing them all within the same program, entirely controlled by how much type information you give it (and how you use t…

Alas, as of last month we changed Pallene's compiler and it now generates C gotos for control flow. ( ^ _ ^ メ ) It helped with certain optimizations...

Ha! Called it again!

But why gotos instead of proper control flow? Is it just easier to emit?

Re: Teal – A statically-typed dialect of Lua

#150

Oof. What is it about the devs who prefer static typing that they insist on bolting it onto every scripting language they can? It's nearly a compulsive disorder. There's plenty of languages with compile time type safety, just go use one of them and leave the perfectly good dynamic ones alone. Static typing proponents need accept that dynamic typing is a perfectly valid way to write and run code: It's way less verbose…

Because when your project reaches the 10k lines mark, you want something telling you "Woops, that function you declared only accepts numbers as the first parameter" and there's nothing preventing lua to have minimal compile time safety while also being backward compatible in fact, I think one of the lua transpilers allowed for function (n number, s string, a) (a is any type here)
Post reply on HN