miércoles, 22 de mayo de 2013

Lua vs javascript

I love lua.  Well, I luvit so far.

I haven't programmed many many things in lua, but the simplicity of it reminds me of smalltalk (in a veery different meaning of simplicity), or scheme.

The fact that it relies in very few known concepts as lexical scope, tables, and.... and that's it.

More that a language, is a language builder toolset.  It lets you do metaprogramming without really feeling that you're doing metaprogramming.  It makes it so simple you'd say it's "the normal thing".
  • loops? ok, you have 'for', and iterators. made from closures, or whatever, but that's it.
  • TCO? yes, but just if it's explicit.
  • splat arrays by default? as in Perl?... yes, just in the last position, perfect for apply-like calls. or you have unpack.
  • Varargs functions? yup.
With that and a bit of syntax sugar here and there, you have a really powerful language with near to no friction.  Provided you know a few other languages, you can always say: "ah, it behaves like js in the everything is hash, but it has proper scoping, and TCO ...."

I don't know much js, but I think lua is like a well done js.  Here's some funny Hacker News opinion



That and the community. #lua is full of people with background in many other languages, wise and helpful. and quite hacker style. I like it :)


Ah! and there's also metalua, which sounds like great fun. something like tcl's block syntax or lisp quasiquoting to mold lua to your needs.


No hay comentarios: