Re: How's ruby compare to it older brother python

From: John Roth (newsgroups_at_jhrothjr.com)
Date: 04/26/04


Date: Mon, 26 Apr 2004 14:22:45 -0400


"Phil Tomson" <ptkwt@aracnet.com> wrote in message
news:c6jg7404m@enews4.newsguy.com...
> In article <108pvmgl0h7m3ea@news.supernews.com>,
> John Roth <newsgroups@jhrothjr.com> wrote:
> >
> >"Hunn E. Balsiche" <hunnebal@yahoo.com> wrote in message
> >news:c6ich0$c5mee$1@ID-205437.news.uni-berlin.de...
> >> in term of its OO features, syntax consistencies, ease of use, and
their
> >> development progress. I have not use python but heard about it quite
> >often;
> >> and ruby, is it mature enough to be use for developing serious
> >application,
> >> e.g web application as it has not many features in it yet.
> >
> >As another poster has mentioned, Ruby is more closely related
> >to Perl than to Python. While I don't use it, people I respect who
> >have moved to Ruby say it has a couple of real killer features;
> >in particular the way blocks and the pervasive use of the visitor
> >pattern come together change the way one writes programs for
> >the better.
> >
> >As far as syntax is concerned, there doesn't seem to be a
> >huge amount of difference. Syntax is syntax, and every language
> >has it's little pecularities.
>
> Well, there is one big difference syntactically: Python uses indentation
> as syntax and Ruby doesn't. Personally I don't prefer Python's
> 'indentation-as-syntax' since it means that syntactically significant
> pieces of my code are invisible and if the tab settings in my editor are
> not the same as yours it can make it difficult to share code (or even
> worse, it might look like everything is OK when we share code, but the
> code which looks exactly the same to each of us, might not be depending
> on how tabs are or are not expanded). It would also seem to be a pain for
> cutting & pasting code as well.

As I said in another post, indentation is the reason I learned
Python in the first place, but it's not the reason I stay with
the language. In fact, I've come to the very heretical view
that the indentation sensitivity is a language design mistake.
It should be the editor's job to handle that level of detail in
a manner that the developer finds workable.

One reason I think it's a language design mistake is that
it's not recursive. That is, it's not possible to shift from
expression level indentation back to statement level
indentation without major disruptions. This is needed for
embedded blocks.

I think Ruby has a reasonable middle ground here: its use of
'end' is fairly unobtrusive compared to, for example, C, C++,
C# or Java. Even so, I think that a reasonable programming
editor would get them out of my face while I was programming.

The tab issue is one of those relatively inconsequential things
that people seem to love to argue about: I'd rather be able to
tell the editor how I want the program formatted, and have done
with it.

> Phil



Relevant Pages

  • Re: Why Ruby over Python?
    ... in other languages like Java, C, Python]. ... Reason 0: First of all, its not necessarily a matter of preferring Ruby ... problem arises when you accidentally, say, mix spaces and tabs, or, if ...
    (comp.lang.ruby)
  • Re: Bruce Eckel and Ruby
    ... If anything I'd go the opposite - it provides him with a potentially larger army of potential attendees at such conferences, especially if Ruby goes mainstream. ... I was chatting with a very keen beta tester of a Python flow tracer product and asked if he had tried Ruby as I preferred it to Python. ... It would need to be for a commercial reason and he had none. ... I guess many in the Python camp won't change language unless they have a business reason to change. ...
    (comp.lang.ruby)
  • Re: Why not adopt "Python Style" indentation for Ruby?
    ... sure if it can be applied to Ruby. ... Languages that use curly braces ... for indentation like C, Perl, etc. are EASY to work with once code is ... Python is a true nightmare to debug and understand once you have code ...
    (comp.lang.ruby)
  • Re: How to adopt "Python Style" indentation for Ruby
    ... don't think that is the main difference between python and Ruby. ... I am not sure why the indentation issue raises so much heat. ... to have generic blocks ala Ruby but from reading some of the PEP's ...
    (comp.lang.ruby)
  • Re: Why not adopt "Python Style" indentation for Ruby?
    ... I think indentation is one of the few ... *language* features where Python leads Ruby.) ... But if it is possible to add this feature to Ruby without breaking ...
    (comp.lang.ruby)