3 ms·
The semantics and capabilities of Gravity mirror those of Lua almost exactly. Class systems, there are literally hundreds to choose from, basic Object/Method su
by sitkack 8y ago
The semantics and capabilities of Gravity mirror those of Lua almost exactly. Class systems, there are literally hundreds to choose from, basic Object/Method support is built into the language. As for globals detection, http://lua-users.org/wiki/DetectingUndefinedVariables http://lua-users.org/wiki/DetectingUndefinedVariables and non-existent attribute lookup https://www.lua.org/pil/13.4.4.html https://www.lua.org/pil/13.4.4.html
Anyone programing in Lua should be well versed in http://www.luafaq.org/gotchas.html http://www.luafaq.org/gotchas.html
Gravity's class system is inflexible compared to Lua where it has Multiple Inheritance https://github.com/limadm/lua-oo https://github.com/limadm/lua-oo Prototypical OO https://github.com/nusov/lua-object https://github.com/nusov/lua-object or anything else you desire.
As for extending syntax and semantics, http://lua-users.org/wiki/MetatableEvents http://lua-users.org/wiki/MetatableEvents provide a clean mechanism to do so.
Lua coroutines are more powerful than Gravity's fibers.
I was hoping that Gravity had pattern matching support, but it looks like it does not.
Given that Lua has more capabilities than Gravity could you substantiate
> Lua is much simpler than Gravity
In what ways?
- lasagnaphil 8y agoYou can create elaborate class systems using metatables in Lua; the problem is that there are hundreds of them. I've done some Lua programming using Love2D, and one of the painful parts was that a lot of the major libraries implemented different class systems (or rolled one of their own), making it hard to include in a single codebase. (At least Lisp has CLOS as its common class system...) Also you can mitigate the "undeclared variable = nil" problem using a script like strict.lua (https://github.com/deepmind/strict/blob/master/strict.lua https://github.com/deepmind/strict/blob/master/strict.lua), but when you try to expand that for field accesses you then want to make sure all of those libraries with different class systems or methodologies are also compatible with it (which a lot of the libraries do not). The underlying problem with Lua is that it went too wild with the philosophy of "being the most expressive using the least amount of features" (so you can implement everything using only metatables). Although many would say that this is a good thing, for me it seems better for a language to have some kind of subset for which people can conform and rely on.
- mmjaa 8y ago>You can create elaborate class systems using metatables in Lua; the problem is that there are hundreds of them. I have done quite a few Lua projects, and I can tell you've not quite gotten it right. The Class system you use is the one you take with you on the project. This is a strength, not a weakness; your patterns are a base file in the project.
- TooBrokeToBeg 8y agoThis has been my experience.
- samatman 8y agoLua provides only a meta-object protocol, without blessing a single class system. I prefer this. Its more Scheme-like, philosophically. I've seen your criticism from many quarters and here's my guess at what happens: people come to Lua from other languages, find missing abstractions, recreate them, and in the process don't thoroughly learn the metamethod system. Pure prototyping is a joy once you realize what all the moving parts are and how many ways they can be usefully combined. This is my experience anyway.
- int_19h 8y ago> the problem is that there are hundreds of them It is a problem when writing general-purpose code in Lua. But why would it be a problem when deciding to embed it, and comparing it to Gravity in this context? With Lua, you'd pick one such system, and stick to it. With Gravity, the system is picked for you - if you don't like it, too bad.