Ruby can be your standard global-function type of language. You don't
have to define objects (though all the 'primitives' are still objects,
you don't have to think about them as such). But if you want to
over-ride the default + method for integers, you can (not that you would

The way it works is that it will just starting executing all the method
calls it sees, like Perl.

And regardless, OOP isn't that hard, I can't understand why someone
wouldn't want to at least take advantage of some its syntax. I guess
thats kind of elitists of me.

Ruby is an awesome programming language entirely built upon the concept of objects. While I just was astounded and excited when learning Perl (because of its many features OO concepts...

How disappointing. Perl certainly doesn't limit it's usefullness only to the
Object-oriented elite. IMHO, that makes Perl rock even more than Ruby.

Oh, and if you like some of that cool Ruby goodness, well, you can always just
install Simon Cozens' module from CPAN.


And from we see...

    rubyisms - Steal some features from Ruby

      package Foo;
      use rubyisms;
      sub initialize {             # We inherit a new from class Class
        self->{foo} = "bar";       # And we have a receiver, self

sub __private_stuff { self->{things} = [ @_ ]; # self is still around
sub my_method {
if ($interesting) { ... }
else { super } # Dispatch to superclass }
sub array_iterator (&@) {
yield() for @_;

     array_iterator { print $_[0], "\n" } ("Hello", "World");

Well, Ruby steals plenty of features from Perl, so I guess thats fair. Though all those @'s, $'s and _'s make me cringe a bit (Ruby has some of that for Regex expressions, but actually has a module called English to give them logical names). As its description says, its just to steal some features from ruby (mainly the yield() call as far as I can tell, don't know enough Perl to see what else is new).

Its one thing to have a yield call, its another when all the standard
libraries are built around exploiting it. Many languages have ways of
passing blocks of code to other methods, Ruby is the first I've seen
actually taking advantage of it throughout the standard libraries.

Hehe. Perl *rocks*. Ruby just *wishes* it could rock this hard. And wait 'til
Parrot/Ponie/Perl6 is out.

Oh, and Simon implemented *ALL* of the above in a mere 90 lines of Perl code.

If you _really_ want to learn about OO and even more ways in which Perl makes OO
easy where other languages "hit the wall" (e.g. closures and multiple
inheritance in Java), then you should get Damian Conway's book Object-Oriented
Perl (ISBN 1884777791 - ). Unbelievably lucid,
and it's no mistake that he used Perl to demonstrate these OO concepts.

The "eat-your-brain" explanation of Perl's "tie" feature is excellent.

He discusses multiple inheritance, data inheritance vs. interface inheritance,
closures, functions as objects, truly private data members, inheritance by
composition, and explores some of the dark corners of Perl's "tie" facility,
re-blessing objects, and more.


Really I don't know enough Perl to be able make a comparison. However, my experience with 'oh yea, Object Oriented looks nice, let's add that' type of languages (which it sounds like Perl is from its history) is from PHP. I quite like PHP, but OO design is hardly ever used in the various libraries. So there are tons of global functions. With Ruby theres only a handful of global functions, they're all methods from the object named Kernel (so unlike other languages, they're aren't really special keywords, part of what makes Ruby so dynamic).

Mercury now has Ruby 1.8.1 (the newest) installed on it. You can use the
ruby shell irb to play around with it easily. Send me a message if
anyone wants other ruby libraries installed, currently it just has the
various standard and the mysql libraries. Kronos has the Debian Woody
package of Ruby, so its version 1.6.

Ian Monroe

----------------------------------------------------------------- To get off this list, send email to [EMAIL PROTECTED] with Subject: unsubscribe -----------------------------------------------------------------

Reply via email to