Hi All,

This interaction happened on a University of Maryland LUG. I thought
that the level of sophistication of this analysis deserved to be
responded to by the experts.

There are two messages here. The first is the one that struck me as so
important. In my opinion the second letter admits marginal advantages to
ruby when compared to python. This may be important to one who has
already invested in python but not to the newbie deciding which craft to
take.

Please include the addresses Dr. Mike and/or the list in your reply.

John

-------- Original Message --------
Subject: Opinion on Ruby maturity (was: Re: Now what)
Date: Thu, 25 Jul 2002 06:37:52 -0400
From: Michael Henry <drmikehenry / drmikehenry.com>
To: John Knight <john / johnknight.com>
 
John Knight wrote:

>[...]
>I do not consider python an improvement over perl but in my view ruby is
>more cleanly designed than either perl or python. 
>
>[...] I suggest
>you look at ruby and demonstrate to yourself that it is an order of
>magnitude more expressive than its predecessors. [...] If
>you come to believe that ruby is more transparent than the other
>languages. i.e. the syntax not not get in the way of understanding then
>you have thousands of programs to rewrite and put into the public
>domain. 
>
I've lately been sweating the question of Python vs. Ruby for
our shop.  I've read several books, and IMHO I like Ruby as a
language better than Python for several reasons [1].  However,
I'm concerned over the maturity of Ruby-related tools and support.
particularly for a few key needs we will be having:

- We need to script C++ apps, and eventually Java apps as well.

- We need to make portable GUI's.  We are dumping MFC.

- We need a stand-alone language for rapid filter-program
  development and the one-off system-administration tasks

A driving goal is to minimize the number of things we must
simultaneously learn (language, GUI library, ...).

Since we need to use Java and Swing for GUI development,
I'd like to be able to use Swing with Python or Ruby.
There is Jython (Java-based Python, www.jython.org) that
provides mature-looking support for Python on a JVM.
There is JRuby (Java-based Ruby, jruby.sourceforge.net) that
has scant documentation and is beta-quality at this time.
I don't know how soon JRuby might become fully usable.

In my position (no real experience with either Python or Ruby,
just a half-dozen books and lots of web browsing) I don't
know whether I'd be painting myself into a corner with Ruby.

Does anyone have enough experience with Ruby to say
if the third-party libraries and support are enough?

Thanks,
Michael Henry

[1] - The advantages I see of Ruby over Python:
- Ruby has single-inheritance with mixins (like Java interfaces)
  and should therefore map better onto JVM's

- Ruby supports regular expressions directly in the language (a la
Perl):
  string =~ /this|that/

- Ruby has an extremely elegant way to pass code blocks to a method,
  and uses it neatly for iterating over a collection:
  list.each do |currentListItem|  print currentListItem end

- Ruby can do "ruby -ne ruby_code_here" like Perl for ultra-quick
  one-liners.  I can't find support for this in Python, and it seems
  unlikely due to Python's "whitespace as syntax" model

- Built-in syntax to create range objects (e.g.,  start .. end)

- Neat case-equality operator for extremely flexible case statement

- Ruby has private, protected and public attributes (Python has none)

- Parentheses may be removed on method calls where unambiguous.
  Supports the principle of uniform access, where the outside world
can't
  tell whether it is accessing an object's data member directly or
through
  a member function, e.g.:
  x = obj.member  # member could be a data item or a method call like 
member()






Hi

I haven't looked at ruby at all but this might be of interest for your
comparison:

On Thu, 25 Jul 2002, Michael Henry wrote:

> [1] - The advantages I see of Ruby over Python:
> - Ruby has single-inheritance with mixins (like Java interfaces)
>   and should therefore map better onto JVM's

I thought Python had mixins, but maybe there's some subtle difference I
don't grasp.

> - Ruby supports regular expressions directly in the language (a la Perl):
>   string =~ /this|that/

In python, not having it directly in the language just means you have to
do "import re". Maybe you want to be able to match using operators, in
that case yes you'd have to write your own wrapper class. I have done
it,
easy and works fine, but if you can get it built in obviously that's
nicer.

> - Ruby can do "ruby -ne ruby_code_here" like Perl for ultra-quick
>   one-liners.  I can't find support for this in Python, and it seems
>   unlikely due to Python's "whitespace as syntax" model

python -c "for x in range(3): print x"

> - Built-in syntax to create range objects (e.g.,  start .. end)

built into python:    foo = range(1,n)
                      x = foo[3:n-2]

> - Ruby has private, protected and public attributes (Python has none)

In python you can do name mangling, which might not be as elegant, but
provides some of the protective functionality. Prepend a
double-underscore
to the variable name and the interpreter will change it during execution
to <classname>__foo. Better than nothing.

Judah