[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cons, tuple and __slots__ -- a simple mechanism to implement them in Lua
- From: Fabien <fleutot+lua@...>
- Date: Fri, 16 Sep 2011 12:19:22 +0200
On Fri, Sep 16, 2011 at 4:21 AM, Xavier Wang
<weasley.wx@gmail.com> wrote:
need the approve of Roberto :(
Do you know why you could add your pet feature so easily in Lua? Because Lua is small, and mostly orthogonal. And one of the reasons why Lua is like that is because the core team is resists adding anything that is even partially redundant, or that doesn't satisfactorily fix an issue which affects most users.
There are plenty of compound types other than tables which would be useful, some of them more than your proposal. If a couple of them had been accepted in Lua already, the language would have been much more complex, and your addition would have been much harder to incorporate correctly. In other words, it's _because_ proposals like yours are "rejected" that they're so easy to write.
Now I've put "rejected" in quotes, because those aren't really rejected, they're simply left as patches: because of Lua's small size, patches are very easy to write and can be shared easily. I have some embedded-specific issues too, but I don't whine about them not being addressed by stock Lua: I used patches shared by others when I could, I wrote and shared patches for the issues that were left unaddressed, and the language hasn't been made messier for the many people who're fine with just tables.
It's very hard to foresee the consequences of a seemingly innocuous addition. Even the very conservative Lua core team sometimes make such mistakes (and they're graceful enough to explain them, so that other people can learn from their mistakes).
There are people who prefer baroque languages, with plenty of features thrown in just in case; they accept that the resulting language ends up complex to master; Perl and C++ are probably the best known examples, and I'd argue that Scala belongs there as well. But that's almost the exact opposite to what Lua's all about.