Live data from Hacker News

What do I think about Lua after shipping a project with 60k lines of code?

blog.luden.io

101–110 of 146 posts

Re: What do I think about Lua after shipping a project with 60k lines of code?

#101
post #73
post #72

Earlier quoted context omitted.

I saw someone describe python as “stressful” for this reason and I couldn’t agree more. It’s difficult to have confidence in any change I make or review. I need to sit down and manually exercise codepaths because I don’t get the guarantees I crave from the language or tooling. While with the small amount of Rust code I’ve written lately I could yolo changes into production with no stress.

Agreed. I had to work in a larger Python codebase after spending a few years with Go and Rust and the drop in logical confidence around the language was remarkable. I have, roughly, sworn off dynamic languages at this point. Although I have dreams of implementing a firm typed system over Common Lisp.

I’m assuming that Python code base didn’t have thorough type hints. What if it had? Would Go still feel safer? I know these aren’t checked in runtime, but Python type system seems more thorough than Go’s, so shouldn’t a Python code base fully typed be even safer than Go? If so, why not?

(I know Python type checks aren’t mandatory, but for this question assume that the type checker is running in CI)

Re: What do I think about Lua after shipping a project with 60k lines of code?

#102
post #5

With dynamically typed languages I feel it's better to wait until you've tried to maintain the code for a while before you consider the languages effectiveness. I had to maintain a very large Lua codebase that has been active for several years. One big problem with Lua was how it will happily take more or less parameters to functions and continue to execute compared to something like Python where it is an error to pa…

One of my coworkers described Python (specifically in reference to a niche framework, but I think it applies generally) as "a bucket of play-doh filled with broken glass"

Does said coworker use mypy?

Re: What do I think about Lua after shipping a project with 60k lines of code?

#103
post #83
post #35

This is the second game I've found out recently that is written in Lua. The first one one being - Beyond All Reason.

Beyond All Reason is a SpringTA fork (hack? build?) like Zero-K ? So the underlying engine isn't Lua, but higher level scripting is. I'm pretty sure this is fairly common, or was once. Other games with Lua scripting: Roblox, Baldur's Gate, Civilization VI, Crysis, Factorio, World of Warcraft, Far Cry, Leadwerks, Friday Night Funkin', Foldit, Garry's Mod, Aquaria, Balanced Annihilation, Bitfighter, Bos Wars, Cataclysm…

Also Supreme Commander

Re: What do I think about Lua after shipping a project with 60k lines of code?

#104
post #73

Earlier quoted context omitted.

Agreed. I had to work in a larger Python codebase after spending a few years with Go and Rust and the drop in logical confidence around the language was remarkable. I have, roughly, sworn off dynamic languages at this point. Although I have dreams of implementing a firm typed system over Common Lisp.

Same, though my trauma was Ruby. Those Rubyists who were apparently born with the language spec in their heads can do amazing things, but I am a mere mortal who needs to be told I wrote bad code right when I wrote it, not told at 2am on a production server.

do you not test your code?

Re: What do I think about Lua after shipping a project with 60k lines of code?

#105
post #90

Earlier quoted context omitted.

> I need to sit down and manually exercise codepaths Isn't that exactly what unit tests are for?

Yeah, that's a common argument for dynamic typing. You're writing tests anyway (right?), and those will catch type errors and many other kinds of error. Why bother with a separate level of checking just for type errors? I personally believe it's a valid argument (others will disagree). IMO the main benefit of static types isn't for correctness (nor performance) - it's to force programmers to write a minimal level of…

[deleted]

Re: What do I think about Lua after shipping a project with 60k lines of code?

#106

Earlier quoted context omitted.

Sorry, but I don't agree that static typing is a replacement for unit tests. I can see static languages having fewer unit tests, but it's not going to eliminate them.

Static typing is a replacement for unit tests aimed to catch type bugs. Also, no one has 100% code coverage so might as we get some guarantees for granted. I understand that statically typed code doesn't mean bug-less code, but I always find it odd that dynamic language enthusiasts feel like they need to stretch the benefits. Dynamic languages are great for many things. Strictness is not one of them and that's fine.

It's obviously not a replacement. You can get the types right but the values wrong due to faulty logic.

Re: What do I think about Lua after shipping a project with 60k lines of code?

#108
post #72

Earlier quoted context omitted.

I saw someone describe python as “stressful” for this reason and I couldn’t agree more. It’s difficult to have confidence in any change I make or review. I need to sit down and manually exercise codepaths because I don’t get the guarantees I crave from the language or tooling. While with the small amount of Rust code I’ve written lately I could yolo changes into production with no stress.

> I need to sit down and manually exercise codepaths Isn't that exactly what unit tests are for?

Fortunately my compiler writes a large number of unit tests for me, that run at compile time! I call it the "typechecker".

Re: What do I think about Lua after shipping a project with 60k lines of code?

#109

Earlier quoted context omitted.

One of my coworkers described Python (specifically in reference to a niche framework, but I think it applies generally) as "a bucket of play-doh filled with broken glass"

Does said coworker use mypy?

Yes. Mypy helps but isn't nearly enough, especially for a gradually typed codebase.

Re: What do I think about Lua after shipping a project with 60k lines of code?

#110
post #96

Earlier quoted context omitted.

> and very much rejects ill-typed programs No it doesn't. Even on the strictest settings, Typescript is unsound in trivial ways, which I hit every time I use it in anger (e.g. undefined in unassigned variables). And Microsoft libraries seem perfectly ok with asserting their type errors away without any validation, specially for JSON values. I had a similar experience with Python until I found Pydantic. I haven't had…

This is sadly so; TS's type system is unsound. But so is C#'s, in ways much more egregious that in TS. Despite that, both languages are very usable in practice, and their static checks prevent a very wide range of problems common in languages without a static type system. If you need bulletproof soundness and JS as the runtime, you have Purescript %)

> in ways much more egregious that in TS

Which ways you say? As far as I know: both TS and C# can carry hidden nulls; both made the mistake of covariant arrays, but C# actually type checks accesses at runtime; and the other unsound case I know of in C# involves a runtime type check as well. Meanwhile, TS (and Python) allow fully unchecked casts into the wrong type.

> both languages are very usable in practice

Agreed, but I still consider TS too unsound in trivial cases for the claim I replied to, despite its expressive power. I think this industry is lacking severely when it comes to basic software correctness.

Post reply on HN