Xah Lee, 2008-12-31
Spent about 3 hours looking into Ruby language today.
The articles i read in detail are:
The Wikipedia gives the best intro and overview in proper context. The “Ruby in Twenty Minutes” is just 4 pages. It give you a very concrete intro to Ruby's syntax and semantics. Stevey Yegge's blog doesn't teach much and rambles, but provides a little personal view. I read it because his opinions i respect.
Will you learn Ruby?
No. For practical application, the lang is some 100 times less libraries or other support than each of Perl, Python, PHP, Javascript. For academic study, functional langs like Mathematica, Haskell, OCaml, Erlang, Qz, are far more interesting and powerful in almost all aspects. Further, there's also Perl6, NewLisp, Clojure, Scala... With respect to elegance or power, these modern lang of the past 5 years match or exceed Ruby.
Do you think Ruby lang is elegant?
Yes. In my opinion, better than Perl, Python, PHP. The syntax is clear and simple, basically in a few hours you feel you know the whole language (similar in situation to Scheme 5 lisp (R5RS)). As a high level lang, it's far better than Java, C, C++ type of shit. However, i don't think it is much better than Emacs lisp, Scheme lisp, Javascript. Note that Ruby doesn't have a spec, and nor a formal spec. Javascript has. Ruby's syntax isn't that regular, nor is it based on a system. Mathemtica's is. (see: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested Notations) Ruby lang's semantic power is probably less than Scheme, and probably same as Javascript, but far less than functional lang such as OCaml, Haskell, Mathematica.
I also didn't like the fact that Ruby uses keyword like “begin”, “end” to indicate code block much as Pascal, Visual Basic, Logo, Bash, do. I don't like that.
Won't Ruby be a interesting learning experience?
Not particularly. Ruby's semantics is pretty much identical to Perl, Python, PHP. There is nothing new in Ruby, when compared to Perl, Python, or Emacs lisp, Scheme lisp.
I am a expert in Perl and PHP, and have working knowledge of Python. I already regretted having spent significant amount of time on Python. (roughly over a year since 2005) In retrospect, i didn't consider the time invested in Python worthwhile.
(I learned no new language features or concepts from knowing Python. Python's syntax is much better than Perl. Python semantics is much clear and easier to learn than Perl too. Its doc is arguably less usable than Perl. (Python's simplicity advantage in comparison to Perl can be easily seen here: Perl and Python Tutorial.) The language power are the same. As it turns out, i don't like Python and Guido cult. Python, like Perl, as i have found out in dismay, is also culty, and has high computer-sciency and OOP pretension over genuine simplicity and practicality (in this regard, Scheme lisp and Haskell's computer science association is actually genuine, and PHP, Javascript's practicality is solid). Python has a anti-functional programing attitude. It supports even less functional programing than Perl. Backward incompatible Python 3 is heading for mumbo-jumbo of iterators, list comprehensions, views ... (Guido has no understanding of functional programing and doesn't like it (see: Lambda in Python 3000. )))
Do you recommend new programers to learn Ruby then?
Not particularly. As i mentioned, if you are interested in practical utility, there's already Perl, PHP, Python, Javascript, which are all widely adopted in the computing industry. If you are interested as a academic exercise, there's Scheme lisp, and much of functional langs such as OCaml, Haskell, Mathematica, which will teach you a whole lot more about computer science, features of language semantics, etc.
Do you condemn Ruby?
No. I think it's very nice, but today there are too many new languages, some are arguably more elegant and powerful than Ruby. See: Proliferation of Computing Languages.
Should I learn Ruby?
If you are leaning a new lang primarily to increase your employability or programing experience, then Ruby will not be of use. Learn PHP, Perl, Python, Javascript, Visual Basic. Each of these are widely used in the industry, which means large number of libraries, integration to other systems, support, etc.
If your purpose is personal edification and exploration, and if you do NOT already know well one of Perl, Python, PHP, then i recommend Ruby. As a lang, it is better than Perl, Python, PHP. If you do already know one of the above, then i recommend learning Emacs Lisp, Javascript, instead. Emacs lisp will teach you lisp's features, in particular lisp's concept of treating variables as symbol (and thus lisp macros), and a uniform syntax system, with immediate practical utility in text processing and writing emacs commands that helps your daily text editing tasks long term. ( See: Text Processing: Emacs Lisp vs Perl and Xah's Emacs Lisp Tutorial. ) Javascript is a necessity in web app field. Its syntax is pretty conservative (C-like syntax) and semantics is very clean. It is becoming one of the standard scripting lang in many niche areas.
Or, you can learn Scheme lisp that has some 30 years history in academic teaching and language research. If you are interested in learning exotic concept in functional lang, there's lots of choices: OCaml (F#), Erlang, Mathematica, each of these are rooted in the industry in niche areas. (e.g. OCaml in automated theorem proving systems, Erlang in fault-tolerant and distributed systems, Mathematica in math and physics research.) For functional lang primarily used in academia, there's Oz, Haskell. For very new functional lang primarily intended for industry, with user base similar to that of Ruby, there's Clojure, Scala, and even Perl6.
Some context: I'm the world's top expert in Mathematica. I'm a expert in Perl, PHP, emacs lisp. I have working knowledge in Python, Javascript, Scheme Lisp, Java.