How I learned to like Ruby

The point of this rant is to annoy people share my experiences with Ruby.

As strange as it seems, I develop deep emotional relationships with programming languages. I love Python. I truly do. I totally irrationally hate Java (though I'm ok with JVM). 

Now, I like Ruby. 

Well, it has some little warts, but generally it is a very enjoyable language.

I didn't "get" Ruby for quite a long time because I tried to wrap my head around it from the wrong end. Ruby didn't like me, I didn't like Ruby -- it lasted until I realized a very simple thing: Ruby is not "like Perl".

The same happened many years ago with JavaScript. I disliked it so much so couldn't make myself write code in it. I hated it until it occurred to me that JavaScript is not "like Java". JavaScript is a Lisp in disguise. Once I realized that, I stopped worrying and quickly found myself in an intimate, romantic relationship with JavaScript. It is still one of my favourite languages.

Then came Ruby. I had to use it because it was a part of my job. At first Ruby felt like a Perl with broken legs. I tried to make it run and it crawled. I missed one important detail: it didn't have legs at all -- it got wings. Ruby flies.

Here comes my little revelation: Ruby is a Smalltalk. Ruby has much more in common with Smalltalk than with anything else. 

Actually it's a better Smalltalk. Since I realized that, I started to enjoy this beautiful language. Hey, peace and happiness -- welcome back.

Conclusion: it is often our own distorted perception that makes good things look ugly.

Rant mode off.

How to make eshell pick up the right PATH

Context:
a freshly installed Emacs on Mac OS X.

Itch:
the PATH is the default system path, not that one you get in your terminal:
~ $ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
~ $ bash -l -c "echo \$PATH"
/Users/mike/.rvm/gems/ruby-1.9.2-p180/bin:
/Users/mike/.rvm/gems/ruby-1.9.2-p180@global/bin:
/Users/mike/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mike/.rvm/bin:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
/usr/X11/bin:/opt/local/bin:/usr/local/cuda/bin:/Users/mike/bin
~ $ rvm
rvm: command not found
Not good.

Scratch:
Now here's the choice: either you fiddle with .MacOSX/environment.plist or use a quick and dirty sub-shell hack. I chose the latter for the sake of not touching XML. The idea is to call bash directly from Emacs and ask it for the right PATH:
(setenv "PATH" (shell-command-to-string "/bin/bash -l -c 'echo -n $PATH'"))
Add the line above to your ~/.emacs and the next time you start eshell you will see:
~ $ echo $PATH
/Users/mike/.rvm/gems/ruby-1.9.2-p180/bin:
/Users/mike/.rvm/gems/ruby-1.9.2-p180@global/bin:
/Users/mike/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mike/.rvm/bin:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
/usr/X11/bin:/opt/local/bin:/usr/local/cuda/bin:/Users/mike/bin
~ $ rvm
= rvm
* http://github.com/wayneeseguin/rvm
...........
blah blah blah...
............
limitations under the License.
Schnell und lustig!