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…
>This meant when we update a function signature we would often incorrectly update call sites, etc. The same thing happened with our huge legacy PHP monolith, which was written before type hints were a thing. Developers were reluctant to refactor large chunks of code when the time came, because it was just too easy to introduce bugs - you couldn’t be confident about anything without manually digging through tons of co…
What do I think about Lua after shipping a project with 60k lines of code?
121–130 of 146 posts
Re: What do I think about Lua after shipping a project with 60k lines of code?
#122Earlier 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.
If using python with type annotations, linters like ruff and mypy do a great job at identifying issues. It's no substitute for tests and nor will it give you the same guarantees that rust will at compile time. But I think it improves the base quality of the code.
E.g. X is a list of strings Translate X to a list of indices Translate X back to a list of strings.
In that paragraph the input and output types are the same, but not complains about the second line.
I always have to introduce a variable with a new name.
Re: What do I think about Lua after shipping a project with 60k lines of code?
#123Earlier quoted context omitted.
> 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. True for any language really. There's an entire category of blog posts: "I used language X for 2 weeks and here's my hot take". Okay, great. But what do you really know? For every language I've used for a serious amount of time I've changed opinion over tim…
This is what makes Java underrated these years. Some annoying stuff pays off over a decade several times. You can make insane complexity with ease.
But the spooky action at a distance type annotation hell, needing builders everywhere because of lack of named parameters, poorly conceived generics, nullability not being first class, lambdas being incompatible with checked exceptions, etc. are a pain.
Re: What do I think about Lua after shipping a project with 60k lines of code?
#124With 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…
I think that much of game development is unlike a lot of other kinds of programming, where there's often more ad hoc game mechanic prototyping than maintenance. This is where dynamic programming excels. But of course, that consideration needs to be balanced against others.
Re: What do I think about Lua after shipping a project with 60k lines of code?
#125Earlier quoted context omitted.
If using python with type annotations, linters like ruff and mypy do a great job at identifying issues. It's no substitute for tests and nor will it give you the same guarantees that rust will at compile time. But I think it improves the base quality of the code.
The thing I find annoying with MyPt is trying to tell it I'm doing variable shadowing. E.g. X is a list of strings Translate X to a list of indices Translate X back to a list of strings. In that paragraph the input and output types are the same, but not complains about the second line. I always have to introduce a variable with a new name.
Even in rust you have to be explicit about doing the same thing with an extra "let" statement.
Re: What do I think about Lua after shipping a project with 60k lines of code?
#126Earlier 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.
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?
#127Earlier quoted context omitted.
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…
Here they are: https://github.com/beyond-all-reason/Beyond-All-Reason https://github.com/ZeroK-RTS/Zero-K
Re: What do I think about Lua after shipping a project with 60k lines of code?
#128With 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…
I understand your frustrations since you are forced to work within a codebase that is shared with other developers with varying levels of experience. Lua was from the get-go never supposed to be a standalone language, it is more of a complimentary language and if you fail to respect that then it becomes unwieldy, quick. It is extremely easy to shoot yourself in the foot with the language and once bad design decisions…
There was some "fun" there. Luajit C functions uses space indentation that becomes tabs every 8 spaces, i.e. mixed tabs and spaces. And his custom assembler for the assembly portions.
I personally spent a lot of time "refactoring code to generate less garbage" as we had purposeful garbage collection in our idle time.
One of the advantages with Lua was that everyone could code in it. I.e. for our games all the artists, sound engineers and producers were developing Lua which was super productive.
But the function signature one in particular - that would have saved me a lot of stress on release nights!
Re: What do I think about Lua after shipping a project with 60k lines of code?
#129Earlier quoted context omitted.
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)
You mean compiler vs client reporting issues? Never safer.
Re: What do I think about Lua after shipping a project with 60k lines of code?
#130Earlier quoted context omitted.
The thing I find annoying with MyPt is trying to tell it I'm doing variable shadowing. E.g. X is a list of strings Translate X to a list of indices Translate X back to a list of strings. In that paragraph the input and output types are the same, but not complains about the second line. I always have to introduce a variable with a new name.
Yeah I see what you mean, you can always disable specific features, but I think that's a habit mypy tries to enforce. They consider redefining a variable bad practice. Even in rust you have to be explicit about doing the same thing with an extra "let" statement.