TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A History of Lua (2001)

141 点作者 atan2将近 3 年前

13 条评论

andrewmcwatters将近 3 年前
My favorite feature of Lua is that it tells you who all of the complexity-loving people in the room are and those who enjoy syntax monocultures.<p>Almost every single time, without failure.<p>I consider its simplicity and the fact that people merely complain about its syntax as highlights of an extremely thoughtful piece of software.<p>I have complaints about its use for threaded work as well as performance, but it’s relatively hard to run into issues with the language in regular practice.<p>I don’t buy the lack of types argument in any programming language to be a compelling argument. Maybe consider that you or other authors you’re working with are bad at writing software. It’s a more boring conclusion and more often more accurate.
评论 #32409846 未加载
评论 #32410087 未加载
评论 #32412130 未加载
评论 #32411390 未加载
评论 #32420614 未加载
评论 #32410074 未加载
评论 #32410010 未加载
评论 #32422172 未加载
SulphurCrested将近 3 年前
The first paragraph in the introduction claims the &quot;failure to fulfill expectations&quot; of Algol 68 and Ada were because they were designed by a committee. Leaving aside whether they were or weren&#x27;t disappointments, neither was really designed by a committee. Algol 68 was famously presented as a fait accompli to the IFIP committee by Adriaan van Wijngaarden, as documented by Dijkstra and leading to the minority report and ultimately Wirth&#x27;s Algol W and then Pascal. Ada was largely designed by Jean Ichbiah, and all the various committees of the US DoD did were choose his design over the competitors.<p>Both languages strongly appealed to me, probably because of their cohesive (one-man!) designs, although I never got the chance to use them professionally. So I do agree that a strong, usually one-person, design is the way to go. But both Algol 68 and Ada failed for other reasons. I&#x27;m speculating, but I suspect they simply required too much of the average programmer: mathematical sophistication in the case of Algol 68, and discipline in the case of Ada.<p>The other plank of TFA&#x27;s argument is that successful languages are built up slowly based on experience of requirements. I think if such a language ends up any good, it&#x27;s either luck or someone spending a lot of effort pushing back on bad proposals. I&#x27;m sure you too have a list of languages in mind which grew in an undisciplined manner, until they strangled themselves. I think of language designers who allow that as like Maxwell Smart in Control headquarters, running coloured strands of wool between pushpins on a map until it&#x27;s a woolly mess.<p>I suspect what really made Lua a success is it found users among game developers at the right time in its development, and did not try to be much more than that. In that sense, by listening to users and adding things, they achieved a good design (I assume – I don&#x27;t really know the language), and because it did not achieve wild success that constituency of users was not so diverse as to baroquify the language.<p>A language can fail if it is a clean design but doesn&#x27;t have users (Eiffel). A language with an ugly, committee, design can succeed if it has users (C++).
评论 #32409545 未加载
评论 #32410156 未加载
amilios将近 3 年前
Honestly Lua is one of those languages that seems decently nice to use, fairly performant, and just makes me wonder why it hasn&#x27;t been adopted for use more broadly in domains beyond just like being embedded in game engines. Am I missing something?
评论 #32409078 未加载
评论 #32408731 未加载
评论 #32411102 未加载
评论 #32409848 未加载
评论 #32409090 未加载
评论 #32408832 未加载
评论 #32408957 未加载
评论 #32408442 未加载
评论 #32408647 未加载
评论 #32408910 未加载
评论 #32409089 未加载
评论 #32408988 未加载
评论 #32409503 未加载
评论 #32410018 未加载
krapp将近 3 年前
I really wish LuaJIT was the standard for Lua. Lua with a C FFI makes it so much easier to work with C libraries like SDL, as opposed to writing Lua bindings from within C. Lua alone is great, but being able to write C structs in Lua and overload operators is <i>chef&#x27;s kiss</i>. Of course you can ignore this opinion if you&#x27;re one of those people who believe C is an abomination to God whose blight should be stricken from the world. To each their own, but for me, Lua is the best C framework out there.<p>Lua is also my go to suggestion whenever threads about which language to use for configuration come up. The syntax of lua tables are basically JSON, except without quoting keys and with comments. And the overhead of embedding it is likely close to nil compared to the interpreter for YAML or whatever.<p>It&#x27;s a nice language. Wish I had something more profound and complex to say about it. I would just suggest considering JuaJIT if you ever do need to work with C and it&#x27;s allowed. Or just Lua if you&#x27;re a masochist and want to deal with the stack.
评论 #32409764 未加载
评论 #32418142 未加载
WalterBright将近 3 年前
We were very pleased that Roberto Ierusalimschy came to DConf last week and gave a great talk on Lua!<p><a href="https:&#x2F;&#x2F;dconf.org&#x2F;2022&#x2F;index.html#robertoi" rel="nofollow">https:&#x2F;&#x2F;dconf.org&#x2F;2022&#x2F;index.html#robertoi</a><p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=04gJXpJ1i8M&amp;t=1711s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=04gJXpJ1i8M&amp;t=1711s</a>
评论 #32421827 未加载
jpe90将近 3 年前
I recently learned lua and wrote an alternative to bat that outperforms it by an order of magnitude. I thought Rust was supposed to be fast! :)<p><a href="https:&#x2F;&#x2F;jeskin.net&#x2F;blog&#x2F;clp&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jeskin.net&#x2F;blog&#x2F;clp&#x2F;</a><p>Love the language!
JonChesterfield将近 3 年前
Lua is my tool of choice for code generators in C projects. Not the intended use case for the language but it&#x27;s very good at it, and a single file lua.c built along with the rest of the project is no bother.
评论 #32413882 未加载
catdawg将近 3 年前
I&#x27;ve worked now for 3 years on a large lua game code base, over 4000 files, 1.5 million lines of code.<p>In the first week or so, I was a bit weirded out by the lack of language features, as I come from C#&#x2F;Typescript&#x2F;C++, but I was very surprised that after 2 or 3 weeks, I was already doing very complex tasks on the code base.<p>I think a lot of that comes from the simplicity of the language. It&#x27;s very difficult to surprise you, everything works in pretty much the same way.<p>Here are some things that I will miss once I move to other languages: (note that most of these are not things that come from simply using lua, you have to implement it into your framework&#x2F;engine, but they are still pretty common)<p>- stack traces print the contents of the variables in the stack. Not all lua code bases have this, but it is easy to implement.<p>- if the code crashes, you can fix the code and continue. This doesn&#x27;t always work, and requires the code base to be written in a way that supports it, but it is definitely possible and I&#x27;ve used it many times.<p>- debugging works really well. You can easily attach and inject code, stop on exception and inspect the state.<p>- settings are also lua code. This is probably the biggest thing I&#x27;ll miss. I love being able to have simple functions as part of settings (e.g. things like tweening functions), being able to generate settings based on other settings, or run simple sanity checks, all on the same file.<p>- index starting on 1, this is definitely an unpopular opinion, but IMO it just makes things so much easier. When you need to access the last element, you just do tbl[tbl_length], no need to decrease by 1, or doing a for loop, you only specify the indices you&#x27;re actually accessing &quot;for i = 1, last_index do end&quot;. I think it really helps with off by 1 errors. I used &quot;normal&quot; indices for over 10 years before this project, and I would still occasionally have these errors, but with lua, I don&#x27;t really remember having them.<p>- not having to fight the compiler to quickly try out different things. Need something from a completely different system? Just add it to the global table and access it from the other place.<p>A big learning I got from transitioning from languages with a very strong type system to a dynamic language like lua, is that in order to be effective, you really need to use code architecture patterns, otherwise things become very hard to reason with. This might be counter intuitive, but I think you need to be a better programmer to use lua effectively, than you need to with a language like C# or Typescript. With the latter languages, the compiler helps you a lot, but with lua, you have to know how to use these things on your own, because you can pretty much do anything and that can be reeeeally bad :)
评论 #32411713 未加载
评论 #32411126 未加载
评论 #32414711 未加载
评论 #32414958 未加载
daneel_w将近 3 年前
At work we make plentiful use of Lua on our telephony backend. As part of many dial plans we need to invoke certain &quot;scripty&quot; functionality - stuff that runs top to bottom to do one thing and then return - which may require e.g. database access, RabbitMQ interaction, Memcached key wrangling etc., and Lua&#x27;s fast start-up and executional speed facilitates this for us on large scale better than almost anything else.<p>We initially began with Python for some of these things, which quickly became an untenable and elaborately consummated performance disaster. There are plenty of techniques to get around its slow start-up and performance issues, but they come with a slew of new complications compared to the simplicity and ability to quickly deploy&#x2F;update&#x2F;execute from local file system.<p>Lua for us makes the difference of being able to, on one and the same piece of hardware, manage a thousand simultaneous phone calls instead of just a few hundred.
einpoklum将近 3 年前
Why only the history until 2001? What about the years since then?
评论 #32414118 未加载
评论 #32412390 未加载
andrewshadura将近 3 年前
Very interesting, the authors find Tcl syntax highly cryptic.
jhatemyjob将近 3 年前
No mention of LuaJIT
评论 #32414323 未加载
rukiwang将近 3 年前
Apart from c, lua is my favourite language. c + lua is the perfect combination and I have developed a lua-based build system using them. <a href="https:&#x2F;&#x2F;github.com&#x2F;xmake-io&#x2F;xmake" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;xmake-io&#x2F;xmake</a>