Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Goodness of Ruby over Python (or not)



A couple of responses to minor points before I start in on my message
about a major one:

On Mon, 26 Feb 2007, Stephen J. Turnbull wrote:

Zev Blut writes:

> so I will end it with this.  I think Ruby and Python have a number
> of similar attributes, but that Ruby has a significantly stronger
> OO model and other

But where is it "stronger"?  What is it that Ruby's model makes
possible, or at least significantly easier and less fragile than in
Python's?

Well, keep in mind that I'm speaking here without the sort of deep knowledge of Python that I'd need to give this some real authority, but I'd strongly suspect that it's becuase Ruby's whole style is designed around and for OO in a way that Python's isn't. This would not be an, "it's that much harder to do in Python" sort of thing, but more that Ruby just flows better in that sense.

I don't know if you've done much Smalltalk, but I suspect that comparing
the both of them to it, you'd get a sense of what I'm talking about.
Ruby, though it's certainly no Smalltalk, is as close as any popular
language has ever gotten to that.

That said, I'm not sure how important this really is, for a couple
of reasons.

First, though Ruby has a lot of the feel of Smalltalk, it's certainly
nowhere near Smalltalk. For example, Ruby has an "if" statement (as
syntax), whereas in Smalltalk it's just another message to an object in
the library. It's hard to explain how important and elegant that is, but
you might get a sense of it by thinking, basically, "Smalltalk has no
'if' in the language."

Second, over the last year or so I've made a very difficult apostasy
from OO fiend to beliving that OO isn't the answer to all life's
problems after all.

Blocks are another matter.  I don't really understand blocks; what are
they good for?

They're a sort of crippled form of lambda; functions with closures that can be used only in certain ways in certain places. For what you use them for most commonly in Ruby, they're quite nice. If you start to use them in a first-class way, they become rather less comfortable.

On Mon, 26 Feb 2007, Stephen J. Turnbull wrote:

...argument that modern functional languages (ML, Haskell) provide
much more powerful abstractions than Python more persuasive, but
that's trumped by GvR's YAGNI. Really, unless you're writing something
insanely abstract like an intelligent revision control system (Darcs),
you don't need the power of something like Haskell.

I'd strongly disagree with this. Please don't take this as any lack of respect to you on my part, as I'm a great admirer of a lot of the stuff that you've done, but this seems to me pretty much akin to a late-1980s C programming saying that you just don't need the power of OO, beyond what you can simulate in C anyway, for most programming projects.

If you're talking ten lines of code, yeah, I'd agree with you. However,
I find even my various sysadmin scripts turning to (and making good
use of) OO once they get beyond thirty or forty lines long. Those same
powerful abstractions that work in extremely difficult programs still
make life easier in the easier programs, as far as I can tell.

The other day (and yeah, this proves how far I have to go) I discovered
that the "Maybe" thing in Haskell is a monad. Who would have thought
you'd need something so sophisticated for something as simple as that?
But then you look at the implementation (which is fantastically simple
and elegant, for something that works with Just Everything), and you
realize that this stuff is wonderful for even the simplest things, and
sometimes you need it even to make those simple things work really,
really well.

cjs
--
Curt Sampson       <cjs@??>        +81 90 7737 2974


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links