This post originated from an RSS feed registered with Ruby Buzz
by Mauricio Fernández.
Original Post: Language features and cross-pollination
Feed Title: fail unless class << self; self end
Feed URL: http://www.thekode.net/blog/Tech/Ruby/syndication.rss
Feed Description: Ruby babblings.
I rencently read Guido’s report on OSCON.
The following caught my attention:
for me the high point of the evening was Miguel de Icaza's excitement
over Python's feature which makes text files iterators yielding the lines
of the file in succession, so that you can write
for line in open(filename):
...process line...
Iterators were introduced in Python 2.2. Ruby has had them forever now.
I then found this small walk-through for Perl6. They
have introduced a new statement (given) which behaves as a switch
were the values compared to decide on the nature of the comparison.
Familiar?
Humbleness
The Ruby community is well aware of its position of inferiority with regard
to Perl’s and Python’s. Matz has been quoted to say that Ruby
is a "Smalltalk rip-off". We know RAA is so much smaller than
CPAN. We are aware of the limitations of Ruby, yet we keep using it. Why?
The Ruby community has often been described as the major asset of this
language. Concepts such as happiness and stress reduction pervade
ruby-talk (one of our highest traffic lists). This is consistent
with matz’ ideals and turns out to be actively supported by the
language itself.
A language that makes people happy
What features make a language a source of happiness for those using it?
It turns out it’s not the features themselves, nor the expressive
power.
We all know Ruby has historically taken lots of things from several
languages, mainly OO concepts from Smalltalk, things from Perl (regexps,
some syntax) and a few things from other languages (yield mostly
from CLU, continuations, closures…). For a long time matz took
features from here and there, added some he thought of independently, and
cared a lot about making a nice, relaxing, beautiful language, without
falling into featuritis.
The language evolved a little bit as time went on, but is still very close
to its original embodiment. We certainly didn’t add object
orientation after the 4th release (amongst other reasons, because Ruby is
still at 1.8 as of now :-), but it was OO from the beginning), nor decided
that we needed generators, iterators, true closures and things after
2.1…
If you have ever programmed in Ruby, you’ll notice you’re using
iterators, blocks, mix-ins… more often than not. This is no wonder,
as they pervade the language, you find them in the core classes, in the
modules, everywhere. As we used them all the time, we became able to make
cool and beautiful things with them. And learned to appreciate them. And we
were happy.
Ruby pollinating other languages…
The folks using Python and Perl have realized how happy Rubyists tend to
be. And they looked for the reason. It seems the answers to their questions
were the features (almost) nobody wanted in the first place, the things
that remained hidden for a long time in cool, minority languages. So they
began to add things to their languages.
Meanwhile, matz keeps refusing new, "cool" features, if their
usefulness isn’t proved, if the syntax isn’t Ruby-like, or if
no suitable name can be found.
Lots of perlers are looking for happiness, without realizing it. They hope
they will find relief for the things that make them suffer now in Perl 5,
sometime in the future (possibly 1 or 2 years away from now), in Perl 6.
The new features ought to give them more power, and make them happier.
I believe matz is right, the others are wrong.
New features appearing in a languages don’t retroactively become a
part of the existing code base. I read some time ago that full OO still had
not made it into Python’s standard libraries: they still have non-OO
things around. The obvious way to rethink libraries to use the new features
and "change the language taste" is rewriting things from scratch
(that’s what Perlers are doing anyway).
The transition to Perl 6 will be an interesting moment. If Ruby is widely
known by that time, several developers will have to choose amongst the
following (and some more) options:
a language with a long "usefulness history", but which became too
bloated at some time, and which promises it will change to make them
happier (by adding features and breaking previous code)
a language that (from the very beginning) made programmers happier, and
became increasingly useful as more people used it
Lots of Ruby users today (most?) are Perl refugees. I believe there will be
many many more when the transition to Perl 6 happens and people re-evaluate
what each language offers. I think Ruby will have a massive number of new
users if Rite becomes real soon (esp. if it works before Parrot).