Slashdot Mirror


What is Perl 6?

chromatic writes "Perl.com has a new article entitled What is Perl 6?. It analyzes the changes to the language in light of the good and bad points of Perl 5 and provides new information about the current state of the project: Perl 6 exists, you can write code in it today, and it's more consistent and easier to use than Perl 5."

4 of 343 comments (clear)

  1. Re:10 Years Overdue by chromatic · · Score: 5, Informative
    Over 10 years later, perl 6 is still in beta mode.

    Did you read the same article I wrote or is your post from the mysterious future? Larry announced Perl 6 in the summer of 2000.

  2. Re:My short experience with perl... by cliveholloway · · Score: 4, Informative

    Oh please.

    "Especially when every perl doc I see around tells me to use curved parentheses for lists, and @ prefixes for variables that refer to them..."

    How hard did you look, really? If you go to Google and type in perl list of lists, the FIRST link takes you here.

    And within 1/2 a page, you see this:

    # assign to our array a list of list references
    @LoL = (
    [ "fred", "barney" ],
    [ "george", "jane", "elroy" ],
    [ "homer", "marge", "bart" ],
    );

    print $LoL[2][2];
    bart

    Damn anti-Perl trolls :-)

    --
    -- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
  3. Re:No language that I like better by Lisandro · · Score: 4, Informative

    Can you recommend a resource for OOP with Perl?

    Right now i found all i needed in the Perl.org site - this OO tutorial for Perl is pretty complete. There's also this one, which is oriented to begginers.

        In fact, i always keep a browser window open to Perl.org when i'm coding Perl - the tutorials are very nice, but the function reference has been priceless to me.

  4. Re:My short experience with perl... by BadAnalogyGuy · · Score: 5, Informative
    This is one area where the Perl docs (as detailed as they may be) fail new users.

    Intuitively, a new user would look at the TOC and see perldata "Perl Data Types" and think that the complete definition of the 3 main Perl data types would be described. So rsidd looks for instructions on creating multidimensional arrays, sees "List value constructors" and gets this:

    LISTs do automatic interpolation of sublists. ... arrays and hashes lose their identity in a LIST... To make a list reference that does NOT interpolate, see the perlref manpage.


    So they head over to perlref (an extra level of indirection) and notice in Item 2:

    A reference to an anonymous array can be created using square brackets:

            $arrayref = [1, 2, ['a', 'b', 'c']];

    Here we've created a reference to an anonymous array of three elements whose final element is itself a reference to another anonymous array of three elements. (The multidimensional syntax described later can be used to access this. For example, after the above, $arrayref->[2][1] would have the value ``b''.)


    But this isn't really easy to understand. Why does he need an arrayref when he wants an array?

    @array = [1, 2, ['a', 'b', 'c']];

    That isn't the same as what he wants. In fact, it's not what you'd expect from DWIM. It's a single entry array, not a multidimensional array. It's not even a list of lists (unless you perform a little magic on it).

    So finally after struggling with this and ending up with some ugly monstrosity like the following:

    @array = @{[1,2,\@{['a','b','c']}]};

    Now his code works, but it isn't very easy to understand, and the maintainers of this code are going to tell everyone how evil and illegible Perl is because the programmer here couldn't figure out how to make a multidimensional array.

    The only FAQ entry with the term "multidimensional" in it refers to some DBM-specific topic that doesn't seem to have any relation to the problem at hand. While "list of lists" may be the preferred term in the Perl community, it would be nice to have a FAQ entry like "How do I create a multidimensional array?"

    As you've mentioned, perllol has the exact syntax of how to do this. Unfortunately for our poor programmer, the link to that is buried in the See Also section alongside perldsc (which is large and contains quite a bit of irrelevant information like 'use strict' information, while at the same time not providing very detailed information about the data structures themselves). The very first 'perldoc perllol' page displayed gives the answer immediately:

    An array of an array is just a regular old array @AoA that you can get
    at with two subscripts, like $AoA[3][2]. Here's a declaration of the
    array:

            # assign to our array, an array of array references
            @AoA = (
                          [ "fred", "barney" ],
                          [ "george", "jane", "elroy" ],
                          [ "homer", "marge", "bart" ],
            );

            print $AoA[2][2];


    Why is it so hard to get to this simple explanation? Why should a neophyte have to go through two documents to finally get to perllol? The FAQ should describe the technique using "multidimensional" as a keyword.

    I love Perl, and I love the depth and breadth of the Perl docs, but they are difficult to navigate for Perl neophytes.