in reply to Re: Can we clap the face of skeptics?
in thread Can we clap the face of skeptics?

An unqualified all Ruby is clearer is questionable, but I don't think saying that there is some Ruby which is easier to read than equivalent Perl is at all questionable.

For instance (heh) given $instance->member( $new_value ) vs instance.member = new_value, the Ruby is more apparently an assignment. Similarly "smarter" instances for built-in classes make for more succinct code in places (array.sort_by { |x| x.abs } vs the equivalent Schwartzian transform).

(Then again judging from the post there could be an English barrier here and "all Ruby" wasn't the claim they meant to make.)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: Can we clap the face of skeptics?
by perrin (Chancellor) on Apr 22, 2008 at 19:27 UTC
    Hmm. Eye of the beholder, I guess. To me, it looks like the Ruby code is trying to redefine the method instance.member() while the Perl code is perfectly clear.
Re^3: Can we clap the face of skeptics?
by Porculus (Hermit) on Apr 23, 2008 at 18:47 UTC

    For the accessor example, you can make it obvious that the Perl is an assignment by giving the method an unambiguous name:

    $instance->set_member( $new_value );

    That takes care of any functional advantage the Ruby syntax might have; anything else is a matter of personal taste. (I won't suggest using an lvalue accessor because AIUI that's not as expressive as the Ruby, though it can provide identical syntax for simple cases.)

    As for the sorting example --

    use Sort::Key 'keysort'; # or ukeysort, for optimisation freaks @array = keysort { abs } @array;

    is not significantly more complicated than the Ruby.