Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Roblox dialect of Lua supports += etc, but how they do it points to why basal Lua doesn't.

In Lua, you can say `a, b = foo(), bar()`. This can have all sorts of unintuitive consequences if there is an addition after, and one of the function calls mutates something the other one depends on. you can also have `a, b = foo()`, since it can return two values.

So Luau (the Roblox dialect) limits += statements to one lvalue, which is unsatisfying but at least a reasonable decision. I think it's worth having, but I get why Lua doesn't include that: they're quite committed to a minimal set of abstractions which compose cleanly.

There are similar answers for all of your questions but, more to the point: Lua doesn't try to be a teaching language. It's minimal, easy enough for a skilled programmer to acquire, and remarkably powerful for how tiny the whole thing is. But to really get somewhere with it, you want to grasp the entire language, and that works against it being a good first language.

That said, it isn't a bad first language either. It does demand more of you as a teacher: we can't expect a nine-year-old to copy-paste a table clone function out of the Lua wiki, or find strict mode in penlight, but it sounds like you're capable of both of those things.

Neither of those are hypotheticals, they're hurdles I cleared years ago and have to consciously remind myself exist in a clean install of the language!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: