I don't feel qualified for an in depth discussion of Ruby, some snippets I heard for further discussions.

  1. Ruby (like Python) doesn't declare variables like Perl does with my or JS with var

    Variables are implicitly declared by first initialization. This leads to ambiguities if you try to assign to a closed over variable. (and sabotages any attempt to realize strict)

  2. Ruby has (had?) problems with blocks in blocks.

    IIRC it wasn't clear if a closed over variable belonged to the top or the middle scope. This lead to changes between different versions and therefore to incompatibilities.

  3. Ruby has some syntactic sugar in FP where Perl needs more syntax.

    refer to RFC: Simulating Ruby's "yield" and "blocks" in Perl as an example.

    or compare lamdas in Perl { my ($x,$y) = @_; ... } and Ruby  { | x,y |  ... }

  4. Ruby and Perl are on a semantic level barely different.

    Quoting Guido: "From a 10 km above perspective Python, Perl and Ruby are the same language".

    I'd like to add from a 10 m perspective this already applies to Perl and Ruby!

    Matz based Ruby mostly on Perl attempting a more pleasant syntax and later spending much time denying it.

    This includes FP!

Maybe stackoverflow is a better place to ask and attract more polyglot crowd for in detail analysis.

Cheers Rolf

( addicted to the Perl Programming Language)


In reply to Re: Perl's functional features compared with Ruby by LanX
in thread Perl's functional features compared with Ruby by gunzip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.