I don't buy the lack of seatbelts argument in any car to be a compelling argument. Maybe consider that you or other drivers you're driving nearby are bad at driving.
Types are a good idea of many languages, but not a universally good idea.
I love your seatbelt analogy. Since seabelts are a good feature of cars, this does not mean at all that they would be a good feature for sailboats. Or for bicycles. In fact, they would be a terrible and very dangerous feature!
And if you happen to want lifejackets and seatbelts on your bicycle, then everybody will be safe to assume that you are an exceptionally bad rider.
Same thing for wanting types on languages where they are not needed.
Types can certainly help prevent something from going wrong, but they're not a zero programmer time cost safety feature.
OP worded it aggressively, but if someone can't see how others benefit from lower overhead, they should look closer.
This is why lua is in beginner sandboxes like robblox, which then will later turn into jaded developers, yearning for types.
For me, using types in Swift is sort of like “NOS” in that it’s helped me go faster (and further”!
In python, go and C maybe, but in typescript? People tend to kungfu-type their APIs way too much where healthy repetition would suffice.
I believe ts typing power will eventually become “considered harmful”. I also think that ts should have a way to intertwine types as it does now, but leave that to technical part of dts and give a way to declare that by <that gibberish> you meant <this clear interface>.
Remind me a bit of Rust's type system.
OK, I've considered it. Now what?
(I don't use typed programming languages, I just want to call out this kind of rhetoric.)
Completely happy to accept that I'm a horrible developer. But that doesn't really solve any of my issues.
(I have absolutely no issues with Lua btw)
Hence the reason cloning is a library function rather than core: when you have only one data structure, there are a lot of ways to copy it, and that's before getting into the various ways that metamethods can override the default behaviors of a table. Do you want to clone every pair in the table, or do you want to clone only the ones returned by `pairs`, which has a metamethod which can override the default behavior?
There are a dozen decisions like this to make.
You are making the classic mistake of thinking you aren't also just as bad as everyone else. Chances are you are just as bad or worse.
Taking advantage of tools that make mistakes less likely and accepting that you suck just as much as everyone else are requirements for being good at writing software I think (this applies to anything really).
Maybe I'm just missing something. If I recall, I was simply trying to create a new 'object' (game character) from a template but it required metatable boiler plate that just made no sense to me.
Many languages, this is simply a = b, or at most allocating some space first.
Lua's designers have a sort of maxim "if it can't be done perfectly, let the user roll their own". This can be frustrating, but for table-copying it's not surprising. Do you copy subtables by reference or value? What about recursive tables? Mutually recursive subtables? Closures in tables? And then userdata can contain references that are opaque to the language runtime. It's not easy to define the behavior of deep copy in the fully general case.
https://github.com/mikelovesrobots/lua-enumerable/blob/maste...
See: table.dup()
Lots of people obviously have a problem with this as it deeply different from the algebra derived assignment syntax.
local a = b creates a local copy, but even then, its not a deepcopy, containing references to other tables.
Almost every single time, without failure.
I consider its simplicity and the fact that people merely complain about its syntax as highlights of an extremely thoughtful piece of software.
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.
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.