Hacker News new | ask | show | jobs
by altarius 1480 days ago
Having used both Python and Ruby professionally and Lua in a hobby setting, they all have their place.

To me, Python feels rooted in procedural programming (as imo evidenced by how many of the built-in base functions behave, statements vs expressions and everything mapping to magic eventually), reminds more of 90s object pascal with syntax-magic than lisp or self.

Then ruby feels like a coherent mix of self/Smalltalk-style "pure" OO and Lisp functional programming, though it's a little "weird" at first when coming from python or c-like langs/java (e.g. iteration is just a method on a collection with the equivalent of a lambda passed in, oh, and that block vs proc vs lambda distinction). So it's not as easy to pick up for mainstream programmers. And since it's often mostly used with rails, that's another whole bag of worms - especially again at first.

Lua is just this special, minimal thing. The whole codebase (including VM internals, lang parser and table) can be studied in an afternoon, the single built-in data structure is actually neat once you're used to it and the c ffi is neat and easy to pick up.

I think python has the familiarity for those coming from mainstream languages, nicely readable syntax and easy uptake going for it. Though I don't like that many new features feel "bolted on" and make the language more complex.

Ruby is just a joy to use once you get into it, although that can take longer than py. Imo, it's combining the best of OO with really practical functional programming.

Lua is to a large extent (and within limits) what you make of it, but a joy to study.

3 comments

> Python feels rooted in procedural programming

Yes it does, and its OOP features feel sloppily bolted and taped on. It seems everyone really wants to use Python in a very OOPy way, so that means using all the awkward features and decorators to try to accomplish what is elegantly simple and clear in Ruby.

Worse even, the functional aspect of Python is a schizophrenic mess, with a mix of functools, builtins, and comprehensions. Meanwhile, in Ruby the structure and patterns of function features is consistent and arguably very sensible.

The only good argument for using Python is, "The people before us used it, and now we continue using it." Even so, there's a good chance that a rewrite in a better language would be worthwhile.

I really wish Lua had taken over the Python space. It's so much better as a language. At this point, though, the Python ecosystem is so huge it's very hard for me to justify investing in Lua.

It's one of those weird path-dependent things, I guess.

Lua has chosen a minimalistic 'batteries-excluded' strategy to ease the integration into host platforms. That strategy worked wonderfully - Lua was always a popular choice for embedding into various platforms (Roblox, Ngnix, Neovim, VLC, Wireshark...).

Python made interfacing just about anything a simple job, which is why it succeeded as "glue" language and automation tool. It is a completely different area than what Lua was designed for even though they are both called a scripting language.

In an alternate timeline Lua could have been used in JavaScript's place though. The web would have benefited from Lua's simplicity and speed.

This is a shockingly fair and, in my opinion, correct comparison of these three languages. Kudos!