The author reflects positively on their experience using Lua for a 60k-line project. They praise Lua's speed, small size, and ease of embedding. While acknowledging the limited ecosystem and tooling compared to larger languages, they found the simplicity and resulting stability to be major advantages. Minor frustrations included the standard library's limitations, especially regarding string manipulation, and the lack of static typing. Overall, Lua proved remarkably effective for their needs, offering a productive and efficient development experience despite some drawbacks. They highlight LuaJIT's exceptional performance and recommend it for CPU-bound tasks.
Elias Daler, the author, reflects on his experience using Lua for a substantial project involving approximately 60,000 lines of code. He primarily focuses on the language's strengths and weaknesses as observed during this endeavor.
Daler begins by highlighting Lua's speed and efficiency. He lauds its performance, particularly in his project which involved computationally intensive tasks like audio processing and game logic updates. He emphasizes that Lua's small footprint and swift execution contributed significantly to the project's success.
He then discusses the advantages of Lua's minimalist nature. This simplicity, according to Daler, made it easier to learn and utilize, even for team members who were not initially familiar with the language. The reduced complexity also facilitated faster development cycles. He contrasts this with larger languages, suggesting they can sometimes hinder productivity due to their size and more intricate features.
Daler subsequently delves into the downsides of Lua. He points to the lack of static typing as a significant drawback, particularly in a larger codebase. This absence, he argues, makes it harder to catch errors early in the development process, leading to more debugging later on. He elaborates on the challenges of refactoring and maintaining code reliability without the benefits of static typing. While he acknowledges mitigating strategies like testing and careful code reviews, he underscores the inherent limitations.
Further addressing the downsides, Daler mentions the limitations of Lua's standard library, particularly regarding string manipulation. He notes that this deficiency often necessitated the creation of custom functions or the reliance on external libraries, potentially increasing development time and complexity.
Despite these shortcomings, Daler expresses a generally positive overall sentiment towards Lua. He acknowledges that the language might not be suitable for all projects, but in his specific context, its performance benefits and simplicity outweighed the negatives. He concludes by suggesting that Lua remains a viable option for projects where speed and a smaller footprint are paramount concerns, especially when coupled with disciplined coding practices and rigorous testing to address the lack of static typing.
Summary of Comments ( 85 )
https://news.ycombinator.com/item?id=43723088
Hacker News users generally agreed with the author's assessment of Lua, praising its speed, simplicity, and ease of integration. Several commenters highlighted their own positive experiences with Lua, particularly in game development and embedded systems. Some discussed the limitations of the standard library and the importance of choosing good third-party libraries. The lack of static typing was mentioned as a drawback, though some argued that good testing practices mitigate this issue. A few commenters also pointed out that 60k lines of code is not exceptionally large, providing context for the author's experience. The overall sentiment was positive towards Lua, with several users recommending it for specific use cases.
The Hacker News post discussing the blog post "What do I think about Lua after shipping a project with 60k lines of code?" has generated a moderate number of comments, many of which delve into the nuances of Lua, its strengths, and its weaknesses, especially concerning larger projects.
Several commenters discuss the challenges of maintaining a large Lua codebase. One commenter points out the importance of establishing robust conventions and leveraging tools for static analysis and linting early on, citing their own experience with a 200k-line Lua project. They emphasize the need for clear coding guidelines to prevent the code from becoming unwieldy, especially when multiple developers are involved. This resonates with another comment that suggests using Typed Lua to mitigate some of these issues.
Another prevalent theme is the discussion around Lua's lack of a robust standard library, with several commenters agreeing that this often leads to developers reinventing the wheel or relying on external libraries. This can lead to dependency management challenges and potential inconsistencies in the codebase. One user specifically mentions missing functionality for handling HTTP requests and JSON parsing as common examples where external dependencies become necessary.
A few comments praise Lua's speed and simplicity, recalling positive experiences using it for embedded systems and game development. One user specifically mentions the ease of embedding and the performance benefits it offers in these contexts.
The discussion also touches upon Lua's dynamic typing. While acknowledging that this can be convenient for smaller projects, some commenters express concerns about its suitability for larger codebases, where static typing can offer better error detection and maintainability. This ties back to the earlier discussion around Typed Lua and the desire for better tooling to improve code quality in large Lua projects.
Finally, a couple of comments compare Lua to other languages like Python and JavaScript, discussing their relative strengths and weaknesses in different scenarios. One commenter suggests that Python's richer ecosystem might make it a better choice for some projects, while another highlights Lua's speed advantage, particularly when embedded within a larger application.
Overall, the comments paint a picture of Lua as a powerful and performant language well-suited for specific niches like game scripting and embedded systems, but one whose lack of a robust standard library and static typing can present challenges when scaling to larger projects. The discussion highlights the importance of adopting rigorous coding practices and potentially leveraging tools like Typed Lua to mitigate these challenges.