Lua, a Misunderstood Language
Sounds like the author is talking about me.<p>I&#x27;m a programmer who recently started teaching his 9 year old son Lua, so that he can use the Undertale fan game platform Create Your Frisk. It&#x27;s gone okay, but there are things about the language that just seem weird and annoying and counterproductive.<p>For example, tables are very important in Lua as a sort of all-purpose data structure, that&#x27;s cool and all, but why is there no built-in copy function? The author of this article seems to be hinting that this anti-batteries-included style grants some sort of freedom to do it myself, which is just kind of silly. I don&#x27;t want to do it myself -- and there&#x27;s a good chance I&#x27;d cock it up if I tried -- my son certainly isn&#x27;t going to do it himself, and even if they had provided such a function, that doesn&#x27;t actually stop anyone from doing it themselves anyway, if they want to.<p>Or, why are there not only no increment operators like ++, but even no operators like +=? &quot;counter = counter + 1&quot; isn&#x27;t only longer to type, it&#x27;s harder to quickly parse. Why is the standard style for multiword identifiers neither camelCase nor underscore_case (or whatever it&#x27;s called), but instead just runthemalltogetherit&#x27;stotallyfine? Why is the default for the random number generator using the same seed every time you run the program, and why does os.time() provide time not in nanoseconds, or milliseconds, but solely in <i>whole</i> seconds? Why doesn&#x27;t the runtime complain if I pass in a completely non-existent variable as an argument into a function?<p>While the teaching has gone fine overall, the language actually works against our purposes by making it harder for my son to build a mental model of what&#x27;s happening. The last point in the previous paragraph, for example: it&#x27;s much more confusing for a newbie coder to have to deal with a &#x27;sudden&#x27; nil value that they weren&#x27;t expecting, than to have a compiler or runtime just crash and say &quot;hey, I don&#x27;t recognize this variable at this line number&quot;. And yes, this isn&#x27;t hypothetical, this actually happened while I was teaching him.<p>Same thing for the dynamic typing, and default global status of variables. The lack of &#x27;declaring&#x27; variable types, or even that a thing is a variable at all, has meant that it&#x27;s been more confusing for him to identify what kind of value a variable is holding, or even that an identifier is actually a variable at all. That variables are by default global has made it harder to teach him about passing in arguments -- he&#x27;ll happily pass in some variable as an argument, and then use <i>that</i> variable name within the function, rather than the argument name defined in the function signature. These are the kinds of beginner-level problems that you forget about as an experienced programmer, but when you teach a kid, suddenly become very real.<p>As I was using the language and teaching with it, I just couldn&#x27;t help but feel that more modern statically typed languages like Swift or Kotlin would be flatly superior for the task of instructing a young mind on the the most fundamental task of beginner programming: getting them to build an accurate mental model of &quot;how this actually works, how does everything relate to each other&quot;. You would get the enforced structure of older static languages, but with more modern syntax and ease of use. To me, it&#x27;s hard to see what Lua would offer as an advantage, really. But then again, I&#x27;m an Android developer, so maybe it&#x27;s just my own experience biasing me.