Live data from Hacker News

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

blog.luden.io

11–20 of 146 posts

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

#11
post #7

Earlier quoted context omitted.

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

TypeScript is sort of "dynamically typed but statically verified".

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.

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

#12
post #11

Earlier quoted context omitted.

TypeScript is sort of "dynamically typed but statically verified".

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

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

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

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

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

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

#17
post #14

Since when is LoC some kind of measurement?

Last 50 years? Have you studied Software Engineering? They discuss LOC in depth and many academic papers on KLOC are in SE literature.

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.

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

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

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

#19

Earlier quoted context omitted.

Last 50 years? Have you studied Software Engineering? They discuss LOC in depth and many academic papers on KLOC are in SE literature.

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.

You're the only person confused about what's meant by LOC here

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

#20
post #10
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…

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

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