3 ms·
Well what I think is that Lua is not nice and clean either for most users. It's silly that there isn't a clean compact implementation of a strictly algol like
by antirez 17y ago
Well what I think is that Lua is not nice and clean either for most users.
It's silly that there isn't a clean compact implementation of a strictly algol like language. Imagine C at higher level, or the basic PHP constructs without the stupid parts. This one:
function sum(a,b) {
return a+b;
}
No OOP, Data types: arrays, hashes, bool, integer, ... the obvious things, with operators to manipulate this stuff for the most boring tasks, and functions for all the rest.
The lingua franca for scripting, as all the other languages will be bised in a way or the other.
- silentbicycle 17y agoThe problem is that clean, compact, strictly algol-like languages tend to snowball into hairy, ad-hoc languages. Thing is, it wouldn't be that hard. How many compiler textbooks involve writing a minimal language like that? Tiger or Oberon, for instance. It's just that people don't stop at a tiny-but-sufficient, because they usually have a completely freestanding language in mind. Embedded languages need restraint to be useful. (Incidentally, I'm hoping to write a Prolog-ish language with embedding in mind this summer, but I already have a bunch of projects going.) Lua is one of few cases where the authors have placed such a high priority on embedded use that the language has been kept small, even when it meant (gasp!) leaving things out of the standard library. It's more like a sane Javascript than an algol-like language, though. (I love it, but it's not everyone's style.)
- alec 17y agoThat function is valid Lua.
- silentbicycle 17y agoNo, the curly braces have a different meaning (lists and tables, what JavaScript calls "object literals"). In Lua, it'd be function sum(a,b) return a+b end Close, though. (The semicolon is optional, and typically only used with multiple statements on one line.)