Re: Perl vs Python vs Ruby



Chris Barts <chbarts+usenet@xxxxxxxxx> wrote:
[ snip ]
> I agree fully, with the exception that @array -> $array[0] is
> somewhat irrational,

I think it makes perfect sense in the context of Perl. And Perl
is all about context. It's what makes it so powerful.

The [$@%] symbols indicate what type of data is being accessed,
not necessarily what type of variable it's accessed from.

> and that being able to use %foo, @foo,
> and $foo as unrelated variables in the same program is insane.

This is a valid point, but not one I personally feel strongly
about. This provides for the following confusion:

my %var = ( 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three');
my @var = qw/zero one two three/;

print "@var[0..3]\n"; # array slice
print "@var{0..3}\n"; # hash slice

But most confusion like this can be avoided by using strict,
warnings, and descriptive variable names.

> Ruby is closely related to Smalltalk and Lisp. If you don't
> know either of those languages, and you should learn them,
> Ruby will indeed look foreign to you. (Personally, I think
> it's a very elegant language.)

$ruby++

Tim Hammerquist
.



Relevant Pages

  • Re: Ruby vs Perl performance
    ... IMHO Perl makes OO unnecessary hard. ... package Foo; ... Now, the Ruby version is much more readable to me, and much easier to work with. ... Does it create a Bar and then initializes it as Foo? ...
    (comp.lang.ruby)
  • Re: Ruby vs Perl performance
    ... Perl objects are most commonly a blessed hash. ... In Ruby, everything's an object. ... thus creating a spontaneous new child of both Foo and Bar. ... def Foo ...
    (comp.lang.ruby)
  • Re: A crosspost from the Perl Community
    ... the Ruby ones will look cleaner to the Ruby ... proponents and the Perl one to the Perl ones. ... Someone who doesn't know either language? ... In any situation, you need a context for beauty, which you pointed ...
    (comp.lang.ruby)
  • Re: Newbie ruby wonderment.
    ... Ruby, like Perl, reads the code line by line, the same as you write it.. ... puts foo ...
    (comp.lang.ruby)
  • Re: Ruby vs. PHP
    ... done is checked out which versions of Perl, Python, YARV, Ruby, jRuby ... dynamic language to the seconds for the benchmark with gcc. ... YARV, Python, Perl and PHP have fairly close medians and the boxes are ...
    (comp.lang.ruby)