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 pass the wrong parameters. This meant when we update a function signature we would often incorrectly update call sites, etc.
I can't remember the specifics but we had a few issues with tables being both dictionaries and lists. IIRC, if you delete a list index and there are later list indices, they will turn into dictionary keys. We had a few bugs to do with not traversing the entire array portion of a Lua table because of this.
I also implemented a few classic algorithms, e.g. bisect in Lua and you have to be very careful with 1-based indices. You also have to be very careful when interfacing between C and Lua. I prefer 0-based indices and [start, stop) style ranges for everything nowadays.
I much prefer statically typed code during maintenance. But dynamically typed languages like Python or Typescript where you can bolt on types, later if you wish, are not too bad.
Also using named parameters as much as possible is great for maintenance.
aomix 2 hours ago [-]
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.
jlarocco 17 minutes ago [-]
> I need to sit down and manually exercise codepaths
Isn't that exactly what unit tests are for?
airstrike 10 minutes ago [-]
[delayed]
pnathan 1 hours ago [-]
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.
shermantanktop 40 minutes ago [-]
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.
When using dynamic languages, either minimize code dependencies / function calls and complexity or ensure high test coverage.
kgeist 7 hours ago [-]
>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 code. So, when business requirements changed, they’d just bolt on some hacks to avoid touching the existing, tested code, and call it a day. It became a self-reinforcing loop: fear of refactoring → more hacks to avoid refactoring → more brittle code → even more fear of refactoring. Eventually, they added type hints and a linter to analyze them, but by that point you start to wonder - why are we even using a dynamic language and fighting its quirks?
shermantanktop 35 minutes ago [-]
This is something I watch out for: teams which fear their own code and operate defensively, typically with cargo-cult practices that accumulate even though they themselves aren’t well understood.
z3t4 3 hours ago [-]
It can be solved with static analysis and type inference. Inference can be tricky though, as you have to backtrack and figure out what type of values functions return etc, so type hints/annotations make the job easier for the IDE/tooling developer, but they are not necessary!
packetlost 41 minutes ago [-]
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"
arp242 15 hours ago [-]
> 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 time. Some things that seemed like neat ideas at the start turned out to be not so neat ideas down the line. Or things I considered pointless or even stupid at the start turned out to be very useful once I better understood the nuances and/or got used to working with it.
And of course it's double hard to judge will come back to haunt you a year down the line.
Even as an experienced programmer I find it hard to properly judge any of that from just a few weeks.
mabster 13 hours ago [-]
To extend on this: There was always this implied impression that the original developers were hot because they got stuff up and running really quickly and that all the newer developers were lukewarm because they weren't getting stuff happening quickly at all, all as a result of the original language choice!
szundi 10 hours ago [-]
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.
ecshafer 3 hours ago [-]
Java is a great language, and the JVM a great platform. I think that the thing which makes Java underrated isn't the language, but rather Java Developers. There are tons of great Java developers, but they are probably great developers in any language. But Java being the language of choice at so many enterprises results in a large number of very low skilled and inadequate Java programmers, who would be bad developers in any language, but specialize in Java.
kmbfjr 3 hours ago [-]
The JVM is awful. In 2025, it still arm wrestles with the OS on which it runs for memory management and still completely loses its shit should the OS decide to send any portion of its precious memory allocation to swap.
The language, is beautiful.
redeeman 2 hours ago [-]
dont swap
TinkersW 2 hours ago [-]
Yeah I had a pretty high opinion of Lua when I first used it, then I came back to code I'd written years earlier, and the lack of types just made it a nightmare.
It really could use a fully statically typed layer that compiles down to Lua, and also fixes some of the stupid stuff such as 1 based indexing and lack of increment ops etc.
discreteevent 1 hours ago [-]
> It really could use a fully statically typed layer that compiles down to Lua.
They mention Luau near the end, and my opinion is that Luau is a significant improvement. Mainly because of the optional typing, but the other features too are each small but impactful quality of life improvements.
drysine 5 hours ago [-]
>when interfacing between C and Lua
Except for the indexing mismatch, I've found calling Lua from C and vise-verse very easy.
> dynamically typed languages like Python or Typescript
You likely mean JavaScript. Typescript is very much statically typed, unless you allow everything to be `any` and `unknown`.
Typescript is mentioned in TFA as a desired (but not available) option, because of the great static typechecking support.
mabster 13 hours ago [-]
I guess I mean both. In that you can take something dynamically typed and add type definitions to make it more typed over time. JavaScript would not be what I'm talking about without the existence of Typescript.
LoganDark 15 hours ago [-]
TypeScript is sort of "dynamically typed but statically verified".
nine_k 14 hours ago [-]
Much like C++ then — the machine code to which it translates lacks types!
A TS compiler will reject an ill-typed program. You of course can just strip the type syntax and get a valid (though buggy) JavaScript code.
LoganDark 14 hours ago [-]
> Much like C++ then — the machine code to which it translates lacks types!
Ehh, not exactly. Most C++ compilers won't output machine code for inputs they don't understand. Though of course, you could simply translate some C++ code yourself into machine code and then say C++ is just like TypeScript in that way. "If you turn C++ into machine code, the machine code lacks types!" "If you turn TypeScript into JavaScript, the JavaScript lacks types!" The main difference is the C++ compiler won't generate machine code for you if the code you provided it doesn't compile, but the TypeScript compiler essentially treats types as a lint (unless extended by compiler plugins such as `typescript-is`, which I greatly enjoyed back in the day).
Also, CHERI begs to differ. And even other than that, machine code isn't dynamically typed because it's not typed at all. Usually, everything is data (usually even the machine code itself, except on Harvard architectures), aside from any architecture-specific memory protections (and other protections), if applicable. I could probably go on about this for days.
> A TS compiler will reject an ill-typed program. You of course can just strip the type syntax and get a valid (though buggy) JavaScript code.
Can't Deno execute TypeScript directly? Last I checked, it didn't do typechecking itself because [the size and complexity of tsc].
For what that's worth, cling also exists, so try tricking that into executing compiler errors. I don't think it would.
nine_k 9 hours ago [-]
> TypeScript compiler essentially treats types as a lint
Sorry, I think you've been swindled.
The Typescript compiler is made by Miscrosoft and is called tsc. It very much heeds the type annotations, and very much rejects ill-typed programs. An LSP based on it does the same in an editor. Also tsc supports refinement types via flow control analysis and a bunch of other static correctness checks.
Deno, bun, swc are not true compilers like tsc, they don't do much correctness checking at all. They discard al the type info, and then operate on pure JS (modules conversion, minification, etc).
debugnik 6 hours ago [-]
> 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 a chance to try Elixir's new type system (is it ready yet?), but at least their strong-arrow model would ensure that runtime checks for dynamically-typed values are done eventually.
ZephyrBlu 2 hours ago [-]
You can lie to TypeScript extremely easily in a way that you can't do in strongly typed languages.
nurettin 7 hours ago [-]
I think they are confused by the tslint project, which is different than tsc and is not supported by Microsoft
But I bet on swc, which is used by Deno internally, or on the Bun's built-in transpiler that does things similar to swc or ts-blank: they all assume that the code is semantically correct (not just syntactically valid) Typescript, and then just ignore the Typescript-specific bits.
I would argue that machine code is typed, but this will be up to interpretation. I.e. you can add two 32 but floating point numbers or two 16 bit integers or store an 8 bit value. It's just doesn't require you to purposefully type pun in some circumstances (e.g. where floating point and integer registers are shared).
jerf 38 minutes ago [-]
A "typed" machine code would imply that you can say "Add these two 32-bit floating points" and the CPU will say "No, I can't, those are 4 8-bit unsigned integers". I don't believe the CPU will ever say that, so it is not typed by any sensible measure. Best you can do is that there may be some registers that can only be used by floating point units and others that can only be used by ints, but even that is really just hardware limitations for performance and not any sort of type assertion; the CPU will happily bit-slam them back and forth without anything like an "exception".
weinzierl 9 hours ago [-]
"And even other than that, machine code isn't dynamically typed because it's not typed at all."
Well, we have bytes, words, doublewords and quadwords on the machine level. They are usually referred to as data types in the processor manuals.
nine_k 7 hours ago [-]
I'd say that instructions are typed, but data are not. You can use an integer arithmetic, bit manipulation, floating point arithmetic, or vector SSE instruction on the very same data in the very same register, and it will just work without any complaints for most bit patterns. A CPU of course does analyze the code, but only the short segment currently in the pipeline, and not for any high-level semantics, just for data dependencies and very local jumps.
ksymph 2 hours ago [-]
So much lua stuff on HN the past few days, I love it.
Defold is a great engine. It has a somewhat steep learning curve (steeper than you'd expect, anyway) and its fair share of quirks, but more often than not the quirks are deliberate tradeoffs that steer you in the direction of structuring your game well. It really feels like an extension of the lua philosophy of giving you a narrow set slightly odd, but very robust and flexible tools that you build everything else out of.
I'm back to using LOVE2D for general tinkering but a few months with Defold really changed how I approach things. I've been meaning to write up a post about it. Either way though, I'd highly recommend checking out Defold to anyone interested.
tc4v 6 hours ago [-]
This dev seems really inexperienced and has weird uninformed takes. The "functional vibe" but it's just using boolean logic, the "reference in a table" bugs that would happen in any language but C, the ignorance of type annotations and so much time spend on problems caused by said ignorance...
kragen 3 hours ago [-]
He may not be super expert, but he doesn't pretend to be. His experience is still valid even if he doesn't really understand what functional programming is yet. (His example isn't just boolean logic.)
Being surprised by aliasing would have happened the same way in many languages, but not everything but C. It can happen in C too! But maybe in Python you would have used an (x, y) tuple and gotten an error from trying to mutate it, and certainly in Haskell or OCaml you wouldn't introduce mutability implicitly. In Tcl there's no way to get that problem in a list of lists, and in languages like Golang or Rust or C# you'd probably use an array of structs which would also be immune to aliasing. You could have the same problem, but it's less likely. I've known experienced programmers who were surprised by aliasing bugs, and even had trouble debugging them, maybe because they spent a lot of time in languages where they were possible but less likely.
What do you mean about ignorance of type annotations?
lolc 5 hours ago [-]
The example is not just boolean logic! In Lua logical ops, the last evaluated value is returned. The example makes use of that to assign something other than a bool. Not all languages do that. In Java for example, boolean logic always evaluates to a bool.
I'm not sure which part of that you missed, but maybe don't go too hard on calling others inexperienced based on your takes.
helsinki 16 hours ago [-]
Almost as many lines as my Neovim config.
xedrac 15 hours ago [-]
But not nearly as many as my Emacs config.
__MatrixMan__ 14 hours ago [-]
Roughly 60k lines more than my Helix config.
para_parolu 11 hours ago [-]
How do you configure awesome plugins for helix then?
john-h-k 4 hours ago [-]
I fork the editor and write them in myself.
This way I can boast about my tiny config while ignoring the tens of hours of hacking the editor itself
teo_zero 10 hours ago [-]
Did I miss something? Plugins for helix? Since when?
My initial point was just that it's kind of nice to have something that's usable from the get-go. I don't miss my gigantic neovim config one bit.
chii 10 hours ago [-]
obviously pre-configured to be awesome already!
MrLeap 16 hours ago [-]
This made me laugh.
nine_k 15 hours ago [-]
One big takeaway: a 60k LOC project in Lua is doable, and it will not crumble under its own weight.
Surprisingly, LuaJIT is not mentioned even once. Luau is mentioned, Teal is mentioned, Fennel, not. (But Haskell is mentioned!)
Little is told about the general code structure, likely because it's dictated by the (C++-based) game engine with Lua bindings. It would be interesting to see an analysis of a comparably large game built with Löve, for instance.
lifthrasiir 14 hours ago [-]
> it will not crumble under its own weight
It is possible to make it not crumble under its own weight, right? I had my share of Lua nightmare with more than 100K lines of code back when I was a gamedev [1], and it seems that there are some requirements in order to remain sane with the growth. Thankfully there are now multiple working type checkers for Lua, unlike when I had to built my own.
You can make anything, even assembler, not "crumble under its own weight" if you, the developer, bring enough discipline and care to it.
The main reason I like static languages and other such things is that after many decades of the programming community developing, since before I was born, we have not found very many best ways of "bringing enough discipline" to a codebase. It really all amounts to the same disciplines over and over. Check the types. Be sure guarantees are maintained. Document the input and output parameters. If there were dozens of very distinct and mutually-contradictory ways to impose this discipline, and there was no clear domination among those ways, then it might make sense for all of our languages to be loosey-goosey and not impose anything directly. But since we all generally find the same disciplines, we might as well pull those up to the language level and thereby enable them to be fully supported, and share the tooling among each other rather than expecting every junior dev to reinvent it from scratch... which they won't.
stevekemp 7 hours ago [-]
Years ago I wrote/maintained a modal console-based email client. It was written with some UI primitives in C++ and the UI actually maintained and controlled by lua.
Viewing a list of folders? Lua. Viewing a list of messages? lua. Viewing a single message? Lua. Those were the three main modes and UI options.
All the keybindings, layout, colour setup, and similar was dynamic. It actually worked out really well. For comparison I just ran "wc -l" against he codebase: 60k lines. Combination of C++ and Lua, but mostly Lua.
Having good scope and good tests made such a thing fine to support. Mostly the pain was broken MIME messages and handling dealing with the external world - e.g. invoking gpg to handle decryption and encryption.
I'd work with big-lua again if I had the need, it's a fun language and very flexible.
wruza 8 hours ago [-]
I read half the article and little is told in it in general. You'd expect some deeper developer reflections on a 60kloc project. Like, much deeper. The part about "spacer" hints that the second half won't surprise either. There's just not enough general xp to make conclusions.
debugnik 9 hours ago [-]
> LuaJIT is not mentioned even once
Defold uses LuaJIT (except for web which I think uses Lua 5.1 compiled to wasm?), so it's taken for granted.
> ...why Lua was designed this way. Dmitry told me that Lua was created at the Pontifical Catholic University of Rio de Janeiro and that it was acceptable for Pontifical Catholic Universities to design programming languages this way.
airstrike 7 minutes ago [-]
[delayed]
ludicrousdispla 10 hours ago [-]
Interesting article, although I am confused by the section referencing 'functional vibes' as the examples given just looks like standard code.
rahil627 8 hours ago [-]
good to see defold win. I prefer the love2D/dragonruby framework ways instead of engine now, but can’t deny defold has it all for 2D: game editor, common game structures provided modularly, deployment, no bloat. I could only wish it was the first engine I used. Life would’ve been so much better!
jokoon 5 hours ago [-]
I am using godot, which uses gdscript, which is known to be a slow language.
But if your engine is already doing the heavy lifting, a slow scripting language will not matter, because it's not doing much.
Also gdscript is pretty nice to use, even if it's lacking tuples, unpacking and other things.
xlii 9 hours ago [-]
I’ve recently moved to the Neovim but even though I learned Lua enough to use it I never found it ergonomic.
Recently had some time to spare and moved to Fennel. It has some sharp edges but in the end I find it much easier to maintain. In fact, I think it’s good enough to replace any kind of Lua for me.
rendall 9 hours ago [-]
It's an unexpectedly funny interview:
> O.C.: Have you consulted about this “tables” approach with other Lua developers?
> I.T.: After that, I went back to Dmitry and asked him if my understanding of “everything is a table” was correct and, if so, why Lua was designed this way. Dmitry told me that Lua was created at the Pontifical Catholic University of Rio de Janeiro and that it was acceptable for Pontifical Catholic Universities to design programming languages this way.
kgeist 7 hours ago [-]
Roblox has 85 mln daily active users and they use a fork of Lua for most logic. Although most games are very basic, some roleplay games must have tens of thousands of LoC.
zharknado 13 hours ago [-]
I played the demo of Craftomation 101 a while back. It was good! Had a good balance of watching emergent behavior and feeling the need to micro-manage/accelerate the process.
Graphical-only instructions were maddening, though! Especially organizing ideas by dragging them around in 2d space. I would have loved the ability to drop into written code.
nirav72 9 hours ago [-]
This is the second game I've found out recently that is written in Lua. The first one one being - Beyond All Reason.
gavmor 20 minutes ago [-]
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, CivCity: Rome, Civilization: Beyond Earth, Company of Heroes, Cortex Command, Counter-Strike 2D, Crimson Steam Pirates, Dota 2, Dungeon Crawl: Stone Soup, Dungeons, Dungeons II, Dungeons III, Elven Legacy, Empire: Total War, Escape from Monkey Island, Eufloria, Exodus from the Earth, Angry Birds.
scambier 9 hours ago [-]
Recently released, Moonring and Balatro are both written in Lua, and I think both with LÖVE.
msephton 9 hours ago [-]
YOYOZO, my game that received a "Best Games of 2023" accolade, was also written in Lua. It is only 39KB despite containing two music tracks, physics and particle systems, online high score board, dynamic sounds, two fonts, a tutorial and more. https://news.ycombinator.com/item?id=38372936
ecshafer 3 hours ago [-]
LOVE is a popular Lua game framework, so quite a few indie games are written in it.
ramesh31 3 hours ago [-]
>This is the second game I've found out recently that is written in Lua. The first one one being - Beyond All Reason.
Lua is traditionally the scripting language of choice for game development. It was absolutely ubiquitous in the industry before the days of Unreal/Unity. Famously, all of the WoW UI was Lua.
pansa2 2 hours ago [-]
Yeah, this presentation by Roberto Ierusalimschy (one of Lua's three authors) lists over 50 games that use Lua (slide #9):
I am surprised that he did not include all of the Souls games, as they are hugely popular.
Oddly enough, I learned that they used Lua by reading the license information which came with the game. I don't remember if it was on the back of the box or in an paper insert, but it surprised me to see it included for some reason.
nvlled 9 hours ago [-]
Grim fandango too
thi2 14 hours ago [-]
Since when is LoC some kind of measurement?
kanbankaren 14 hours ago [-]
Last 50 years?
Have you studied Software Engineering? They discuss LOC in depth and many academic papers on KLOC are in SE literature.
chickenzzzzu 13 hours ago [-]
I can write a program that is 1,000,000 lines of code, and a program that is 200 lines of code, and to the end user they would be doing the same thing.
Now, if you start establishing some rules about the type of code I'm allowed to write, then your statement becomes truer. But by no means do people actually follow that in the real world all the time.
pests 13 hours ago [-]
The number was given just so we have a sense of scale of the project being talked about. Its not a competition nor are measures being made.
If you wrote a program that is 1,000,000 lines of code you could also write a blog post about your thoughts on "writing 1,000,000 lines of code".
You could also write a program that is 200 lines long and write a blog post about "writing 200 lines of code".
One is not better than the others, you are just informing your audience of the topic under discussion.
viccis 9 hours ago [-]
>I can write a program that is 1,000,000 lines of code, and a program that is 200 lines of code, and to the end user they would be doing the same thing.
I think most conversations around LOC assume that it's not an idiot writing it, and I think in general, this is a good assumption to use when it comes to code discussions.
TJSomething 12 hours ago [-]
Sure, but, assuming you are actually only counting lines of code and not whitespace or comments, if that end user asks for a new feature, it's probably going to be a lot easier to figure out where to put it in 200 lines than in 1,000,000 lines.
atomicnumber3 13 hours ago [-]
You're the only person confused about what's meant by LOC here
otikik 12 hours ago [-]
You can assume the measurement is “Lines of Code that matter” then.
runevault 10 hours ago [-]
Do you really think LoC does not impact maintainability? How much depends on language and adjacent tooling for things like refactors, but the larger a code base the harder it is to maintain in general.
Rendered at 16:05:55 GMT+0000 (Coordinated Universal Time) with Vercel.
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 pass the wrong parameters. This meant when we update a function signature we would often incorrectly update call sites, etc.
I can't remember the specifics but we had a few issues with tables being both dictionaries and lists. IIRC, if you delete a list index and there are later list indices, they will turn into dictionary keys. We had a few bugs to do with not traversing the entire array portion of a Lua table because of this.
I also implemented a few classic algorithms, e.g. bisect in Lua and you have to be very careful with 1-based indices. You also have to be very careful when interfacing between C and Lua. I prefer 0-based indices and [start, stop) style ranges for everything nowadays.
I much prefer statically typed code during maintenance. But dynamically typed languages like Python or Typescript where you can bolt on types, later if you wish, are not too bad.
Also using named parameters as much as possible is great for maintenance.
Isn't that exactly what unit tests are for?
I have, roughly, sworn off dynamic languages at this point. Although I have dreams of implementing a firm typed system over Common Lisp.
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 code. So, when business requirements changed, they’d just bolt on some hacks to avoid touching the existing, tested code, and call it a day. It became a self-reinforcing loop: fear of refactoring → more hacks to avoid refactoring → more brittle code → even more fear of refactoring. Eventually, they added type hints and a linter to analyze them, but by that point you start to wonder - why are we even using a dynamic language and fighting its quirks?
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 time. Some things that seemed like neat ideas at the start turned out to be not so neat ideas down the line. Or things I considered pointless or even stupid at the start turned out to be very useful once I better understood the nuances and/or got used to working with it.
And of course it's double hard to judge will come back to haunt you a year down the line.
Even as an experienced programmer I find it hard to properly judge any of that from just a few weeks.
The language, is beautiful.
It really could use a fully statically typed layer that compiles down to Lua, and also fixes some of the stupid stuff such as 1 based indexing and lack of increment ops etc.
That's Teal: https://github.com/teal-language/tl
Except for the indexing mismatch, I've found calling Lua from C and vise-verse very easy.
You likely mean JavaScript. Typescript is very much statically typed, unless you allow everything to be `any` and `unknown`.
Typescript is mentioned in TFA as a desired (but not available) option, because of the great static typechecking support.
A TS compiler will reject an ill-typed program. You of course can just strip the type syntax and get a valid (though buggy) JavaScript code.
Ehh, not exactly. Most C++ compilers won't output machine code for inputs they don't understand. Though of course, you could simply translate some C++ code yourself into machine code and then say C++ is just like TypeScript in that way. "If you turn C++ into machine code, the machine code lacks types!" "If you turn TypeScript into JavaScript, the JavaScript lacks types!" The main difference is the C++ compiler won't generate machine code for you if the code you provided it doesn't compile, but the TypeScript compiler essentially treats types as a lint (unless extended by compiler plugins such as `typescript-is`, which I greatly enjoyed back in the day).
Also, CHERI begs to differ. And even other than that, machine code isn't dynamically typed because it's not typed at all. Usually, everything is data (usually even the machine code itself, except on Harvard architectures), aside from any architecture-specific memory protections (and other protections), if applicable. I could probably go on about this for days.
> A TS compiler will reject an ill-typed program. You of course can just strip the type syntax and get a valid (though buggy) JavaScript code.
Can't Deno execute TypeScript directly? Last I checked, it didn't do typechecking itself because [the size and complexity of tsc].
For what that's worth, cling also exists, so try tricking that into executing compiler errors. I don't think it would.
Sorry, I think you've been swindled.
The Typescript compiler is made by Miscrosoft and is called tsc. It very much heeds the type annotations, and very much rejects ill-typed programs. An LSP based on it does the same in an editor. Also tsc supports refinement types via flow control analysis and a bunch of other static correctness checks.
Deno, bun, swc are not true compilers like tsc, they don't do much correctness checking at all. They discard al the type info, and then operate on pure JS (modules conversion, minification, etc).
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 a chance to try Elixir's new type system (is it ready yet?), but at least their strong-arrow model would ensure that runtime checks for dynamically-typed values are done eventually.
But I bet on swc, which is used by Deno internally, or on the Bun's built-in transpiler that does things similar to swc or ts-blank: they all assume that the code is semantically correct (not just syntactically valid) Typescript, and then just ignore the Typescript-specific bits.
Well, we have bytes, words, doublewords and quadwords on the machine level. They are usually referred to as data types in the processor manuals.
Defold is a great engine. It has a somewhat steep learning curve (steeper than you'd expect, anyway) and its fair share of quirks, but more often than not the quirks are deliberate tradeoffs that steer you in the direction of structuring your game well. It really feels like an extension of the lua philosophy of giving you a narrow set slightly odd, but very robust and flexible tools that you build everything else out of.
I'm back to using LOVE2D for general tinkering but a few months with Defold really changed how I approach things. I've been meaning to write up a post about it. Either way though, I'd highly recommend checking out Defold to anyone interested.
Being surprised by aliasing would have happened the same way in many languages, but not everything but C. It can happen in C too! But maybe in Python you would have used an (x, y) tuple and gotten an error from trying to mutate it, and certainly in Haskell or OCaml you wouldn't introduce mutability implicitly. In Tcl there's no way to get that problem in a list of lists, and in languages like Golang or Rust or C# you'd probably use an array of structs which would also be immune to aliasing. You could have the same problem, but it's less likely. I've known experienced programmers who were surprised by aliasing bugs, and even had trouble debugging them, maybe because they spent a lot of time in languages where they were possible but less likely.
What do you mean about ignorance of type annotations?
I'm not sure which part of that you missed, but maybe don't go too hard on calling others inexperienced based on your takes.
My initial point was just that it's kind of nice to have something that's usable from the get-go. I don't miss my gigantic neovim config one bit.
Surprisingly, LuaJIT is not mentioned even once. Luau is mentioned, Teal is mentioned, Fennel, not. (But Haskell is mentioned!)
Little is told about the general code structure, likely because it's dictated by the (C++-based) game engine with Lua bindings. It would be interesting to see an analysis of a comparably large game built with Löve, for instance.
It is possible to make it not crumble under its own weight, right? I had my share of Lua nightmare with more than 100K lines of code back when I was a gamedev [1], and it seems that there are some requirements in order to remain sane with the growth. Thankfully there are now multiple working type checkers for Lua, unlike when I had to built my own.
[1] https://news.ycombinator.com/item?id=18351788 is my canonical answer, but I have written many other comments about Lua which should be easy to search.
The main reason I like static languages and other such things is that after many decades of the programming community developing, since before I was born, we have not found very many best ways of "bringing enough discipline" to a codebase. It really all amounts to the same disciplines over and over. Check the types. Be sure guarantees are maintained. Document the input and output parameters. If there were dozens of very distinct and mutually-contradictory ways to impose this discipline, and there was no clear domination among those ways, then it might make sense for all of our languages to be loosey-goosey and not impose anything directly. But since we all generally find the same disciplines, we might as well pull those up to the language level and thereby enable them to be fully supported, and share the tooling among each other rather than expecting every junior dev to reinvent it from scratch... which they won't.
Viewing a list of folders? Lua. Viewing a list of messages? lua. Viewing a single message? Lua. Those were the three main modes and UI options.
All the keybindings, layout, colour setup, and similar was dynamic. It actually worked out really well. For comparison I just ran "wc -l" against he codebase: 60k lines. Combination of C++ and Lua, but mostly Lua.
Having good scope and good tests made such a thing fine to support. Mostly the pain was broken MIME messages and handling dealing with the external world - e.g. invoking gpg to handle decryption and encryption.
I'd work with big-lua again if I had the need, it's a fun language and very flexible.
Defold uses LuaJIT (except for web which I think uses Lua 5.1 compiled to wasm?), so it's taken for granted.
> ...why Lua was designed this way. Dmitry told me that Lua was created at the Pontifical Catholic University of Rio de Janeiro and that it was acceptable for Pontifical Catholic Universities to design programming languages this way.
But if your engine is already doing the heavy lifting, a slow scripting language will not matter, because it's not doing much.
Also gdscript is pretty nice to use, even if it's lacking tuples, unpacking and other things.
Recently had some time to spare and moved to Fennel. It has some sharp edges but in the end I find it much easier to maintain. In fact, I think it’s good enough to replace any kind of Lua for me.
> O.C.: Have you consulted about this “tables” approach with other Lua developers?
> I.T.: After that, I went back to Dmitry and asked him if my understanding of “everything is a table” was correct and, if so, why Lua was designed this way. Dmitry told me that Lua was created at the Pontifical Catholic University of Rio de Janeiro and that it was acceptable for Pontifical Catholic Universities to design programming languages this way.
Graphical-only instructions were maddening, though! Especially organizing ideas by dragging them around in 2d space. I would have loved the ability to drop into written code.
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, CivCity: Rome, Civilization: Beyond Earth, Company of Heroes, Cortex Command, Counter-Strike 2D, Crimson Steam Pirates, Dota 2, Dungeon Crawl: Stone Soup, Dungeons, Dungeons II, Dungeons III, Elven Legacy, Empire: Total War, Escape from Monkey Island, Eufloria, Exodus from the Earth, Angry Birds.
Lua is traditionally the scripting language of choice for game development. It was absolutely ubiquitous in the industry before the days of Unreal/Unity. Famously, all of the WoW UI was Lua.
https://www.inf.puc-rio.br/~roberto/talks/curryon2017.pdf
Oddly enough, I learned that they used Lua by reading the license information which came with the game. I don't remember if it was on the back of the box or in an paper insert, but it surprised me to see it included for some reason.
Have you studied Software Engineering? They discuss LOC in depth and many academic papers on KLOC are in SE literature.
Now, if you start establishing some rules about the type of code I'm allowed to write, then your statement becomes truer. But by no means do people actually follow that in the real world all the time.
If you wrote a program that is 1,000,000 lines of code you could also write a blog post about your thoughts on "writing 1,000,000 lines of code".
You could also write a program that is 200 lines long and write a blog post about "writing 200 lines of code".
One is not better than the others, you are just informing your audience of the topic under discussion.
I think most conversations around LOC assume that it's not an idiot writing it, and I think in general, this is a good assumption to use when it comes to code discussions.