Live data from Hacker News

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

blog.luden.io

41–50 of 146 posts

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

#41
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.

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

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

#42
post #11

Earlier quoted context omitted.

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.

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

> 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).

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

#44
post #6

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…

60k? try Roblox’s 60bajillion!

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

#45
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!

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

#46
post #6

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…

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.

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

#47
post #42

Earlier quoted context omitted.

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

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

I think they are confused by the tslint project, which is different than tsc and is not supported by Microsoft

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

#49
post #42

Earlier quoted context omitted.

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

I think they are confused by the tslint project, which is different than tsc and is not supported by Microsoft

Or maybe even https://github.com/bloomberg/ts-blank-space

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.

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

#50

Earlier quoted context omitted.

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

"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.

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.
Post reply on HN