Re: Two years of Python

Andrew writes about Python, Perl and Ruby:

Ruby has some nice things (like Perlish regular expression handling), but it brings back all that punctuation noise again.

He gives an example of punctuation noise in Perl:

I go back to Perl and my eyes bleed after trying to dereference a reference to a scalar, or something like that. It’s just ugly in Perl.

I don’t think that’s fair to compare Perl’s ponctuation noise with Ruby. Ruby has a feature that could qualify as punctuation noise, but it’s really a feature: variables are prefixed with their scope. For example, class variables start with @@ (@@var), instance variables start with @ (@var), global variables start with $ ($var), and constants are in CAPS.

I don’t know if Ruby “invented” that, or if it comes from another language (it’s probably the case: Ruby takes a lot of good ideas everywhere).

Also, Andrew, joining elements of an array in ruby is written myarray.join(” “), and Ruby has =~. So you should definitely give Ruby a try ;) No, seriously, Ruby is a really interesting language. It’s really a shame that it’s still so japanese-centric (most development decisions are taken on a japanese mailing list !!), since it’s not really help a wide adoption.

3 thoughts on “Re: Two years of Python

  1. don’t know if Ruby “invented” that

    In Eiffel, classes are named in ALL_CAPS, instance variables in underscored_lowercase.

    In Smalltalk, the convention for identifiers is always CamelCase, but names with local scope have a lowercase initial, and names with global scope are capitalized (like common and proper nouns). There is no constants. No need for more conventions because temporary variables are declared (which is a good thing IMHO, even in a dynamic language) and, because of encapsulation, objects can’t access instance variables of their class. There are different kinds of non-local variables, such as class variables or pool variables, but they are very seldom used and even considered bad style.

  2. Its kinda funny to think that 99.9% of computer development is in English and Folks complain that Ruby is not ;-) 99.9% of the non-english-speaking world is amused ;-)

  3. I think join() should not be a member of either class. It seems like a much better candidate would be a simple function. Either join(string, list) or join(list, string), or even both.

    Not everything has to be OO. There are some places where it just doesn’t make that much sense. I think this is one of them.

Comments are closed.