4 ms·
These are quite unfair arguments against Lua, especially since that you seem to be using it for low level networking code and on embedded systems, which are not
by jack1243star 8y ago
These are quite unfair arguments against Lua, especially since that you seem to be using it for low level networking code and on embedded systems, which are not really Lua's strong points. (Lua is designed to be embedded as per being a scripting interface to C and other compiled languages.)
One based indexing is just a design choice, while it complicates interoperation, I find it justified as Lua tables are actually hash tables, so it would be weird to model it upon memory offsets. It reminds me that I am only dealing with a hashmap with integers as keys.
Bitwise and UTF-8 string operations are lacking out of the box, but these are arguably too specialized to be expected in a general scripting language. The patterns are a little underpowered compared to other languages, but it is still quite useful. I suggest looking into LPEG for more complicated operations. Lua 5.3 do have some functions to deal with UTF-8 codepoints.
Also, regarding Unicode, I'd rather the PL provide only operations on bytes, and let me decide what "characters" are to be represented. Nearly all PL providing some Unicode facilities fail in different ways, just let me deal with ICU myself if I really need Unicode. Also it is a royal pain in the butt to deal with different encodings, with a language having special "characters" and "strings" constructs.
I don't understand the complaint on documentation. It is one of the most practical and clear technical writing that I have seen, if a little terse. Perhaps you mistook the wiki as the main document? (The Lua language manual is an one-page HTML page.)
- mschuetz 8y ago> One based indexing is just a design choice, while it complicates interoperation, I find it justified as Lua tables are actually hash tables, so it would be weird to model it upon memory offsets. It reminds me that I am only dealing with a hashmap with integers as keys. One based indexing isn't just about memory offsets or getting used to it, it makes lots of things a nightmare. Like index-math that involves the modulo operator, which will result in zero values, which are invalid for 1-based indexing. Or turning a 2D or 3D index into a 1D index, which now requires completely unnecessary additions or subtractions of 1s. And other index magic that I frequently need for computer graphics and number crunching.
- bsder 8y ago> These are quite unfair arguments against Lua, especially since that you seem to be using it for low level networking code and on embedded systems, which are not really Lua's strong points. (Lua is designed to be embedded as per being a scripting interface to C and other compiled languages.) If this is true, and I actually agree with you, then where is Lua actually better than an alternative? And, while I don't share the specific points of the parent poster, I experienced similar issues with Lua. I found that while the Lua core language itself is small, I had to compile in so much extra stuff to make it useful that it wasn't actually small anymore. And, once you get large enough that you start demanding big ARM Cortex M4 microcontrollers, Python is now in your scope.
- wtetzner 8y ago> I found that while the Lua core language itself is small, I had to compile in so much extra stuff to make it useful that it wasn't actually small anymore. I think the idea is that most functionality is meant to be provided by the host program. If you want a standalone scripting language, then Lua probably isn't for you.
- imtringued 8y agoRunning untrusted code to allow modding of games. Suddenly the fact that you have a standard library or a complex language with a large amount of features is no longer a benefit and instead is actually a liability often to the point that you disable the standard library in lua entirely and only selectively load parts of it and write your own modding API to allow modification of the game. There are entire games built around modding via lua such as gary's mod which similar to a web browser has to download random code from a server. Then there are mods like computercraft/opencomputers for minecraft in which direct file access to the host doesn't make any sense at all because every computer has it's own filesystem. I just looked up Python's sandboxing capabilities and I can't find anything. All I see is answers like [0] that suggest that it's not trivial. What about other implementations like pypy that claim to have a sandbox? [1] I can see lots of warnings like "This is not actively maintained." The lack of mature sandboxing for python makes it impossible to use for the usecases I've described above. [0] https://stackoverflow.com/questions/3068139/how-can-i-sandbox-python-in-pure-python https://stackoverflow.com/questions/3068139/how-can-i-sandbo... [1] http://doc.pypy.org/en/latest/sandbox.html http://doc.pypy.org/en/latest/sandbox.html
- anilakar 8y ago>These are quite unfair arguments against Lua, especially since that you seem to be using it for low level networking code and on embedded systems, which are not really Lua's strong points. Why is Lua an oft-recommended programming language for embedded development if one is not allowed to form opinions on the language? >so it would be weird to model it upon memory offsets Why does the language provide table constructors {1, 2, 3} that do one-based indexing then? Why is there a table length operator (#) that works on one-based indexes? Why does ipairs work with one-based indexes? A sequential data type (array, list, for some quirky reason named "tables" in lua) is one of the most basic data structures of a programming language. If Lua is supposed to be a scripting language, why should a programmer care about the underlying implementation? >Bitwise and UTF-8 string operations are lacking out of the box, but these are arguably too specialized to be expected in a general scripting language. Is Lua a toy or a tool? >Lua 5.3 do have some functions to deal with UTF-8 codepoints I welcome you to the real world, where 5.1 is still the latest available release available on too many platforms. >Perhaps you mistook the wiki as the main document? Lua-users.org turns up as the first result when you google for documentation.
- boomlinde 8y ago> Why is Lua an oft-recommended programming language for embedded development if one is not allowed to form opinions on the language? I have never heard anyone recommend Lua for embedded development. It's an embeddable language in the sense that you can easily embed the entire interpreter in a larger application and extend it. That it happens to be relatively small and easy on memory is a bonus, not a reason to believe that it's a great systems programming language. I'm not at all surprised that it disappointed you as a language for low level networking code. Most Lua success stories are about its use as a high level glue/scripting/configuration language, letting the application handle the low level code via an API.
- scruple 8y agoWhat you're saying is true, but it's not a stretch, in an embedded system, where you are using Lua as a "high level glue/scripting/configuration language, letting the application handle the low level code via an API" to then consider using it for scripts and more on the device itself. The runtime is small and, all things considered, it's very fast. While I never got to a place where I was writing low-level networking code with it, when I was still in embedded I did use it for a number of tasks that it was perhaps not quite perfectly suited for because of it's characteristics. I'm no longer in embedded, but I can easily imagine having pushed that idea further with projects like LuaJIT showing up in more recent years.