Slashdot Mirror


Perl Features of the Future - Part 1

Kevin writes "This story highlights some of the features being included in Perl 6. "There will be substantial changes in the move from Perl 5 to Perl 6. We've been hamstrung for a while by the need to maintain backward compatibility all the way back to Perl 1. There are some things we want to remove, because they seemed like good ideas when they were introduced but they're more trouble than [they're worth] now."

3 of 61 comments (clear)

  1. Re:balanced parens: NO YOU CAN'T by m_ilya · · Score: 2, Informative
    This faq entry is a bit outdated. There is experimental extended regexp syntax which allows to match balanced expressions. There is even an example in perlre (look for documentation on (??{ code }) syntax construct).

    Also there exist CPAN module Text::Balanced which does balanced expressions matching.

    --

    --
    Ilya Martynov (http://martynov.org/)

  2. Re:Code parsing by babbage · · Score: 2, Informative
    Yes. In fact, you can do this sort of thing using Damian Conway's Parse::RecDescent module, which lets you parse a linear input (like say any file or string) into a tree structure on which you can do arbitrary manipulation. -- including HTML/XML parsing, handling balanced parens, or yes your VBScript quoting example.

    Parse::RecDescent is available for the 5.x series (I think it's part of the core download for 5.8, and was optional for 5.6, but am not 100% sure about that), but it seems like it's going to become a more core component when 6 arrives. If you want to be able to do this stuff, look into it -- you don't have to wait for Perl6 to start using this. It's available now, and it's *great*. :)

  3. Hard to read Perl [5] by SeanAhern · · Score: 3, Informative
    [Perl 5 is] NOT HARD TO READ UNLESS YOU MAKE IT HARD TO READ!!!

    If it's not hard to read, then why are the designers of perl 6 making a lot of efforts to make it a lot easier to read than perl 5?

    Quoting Larry Wall from the Apocalypses:
    • In fact, regular expression culture is a mess, and I share some of the blame for making it that way. Since my mother always told me to clean up my own messes, I suppose I'll have to do just that. [emphasis mine]
    • But Perl has often been tagged as a language in which it's easy to write programs that are difficult to read, and it's no secret that regular expression syntax that has been the chief culprit. [emphasis mine]
    • there's a lot of regex culture that needs breaking.
    • [Read all of Apocalypse 5 to learn exactly why perl 5 sucks to read. Even the extended syntax ain't really the most readable syntax.]
    • As a specific example, there are various ways things could improve if we muster the courage to break the ``weird'' relationship between @foo and $foo[]. ... the botch that in Perl 5 requires us to distinguish $foo[] from $foo->[]
    • I think length(@array) should be equivalent to @array.length(), so if there's a length method available, it should be called.
    • Legacy Perl $pkg'var Should Die.
      I agree. I was unduly influenced by Ada syntax here, and it was a mistake.
    • odd looking constructions like: $foo->[1][2][3]
    • We're definitely killing Perl 5's slice syntax
    • Various special punctuation variables are gone in Perl 6
    • Typeglobs are gone.
    • I'd like to get rid of the gratuitously ugly \E as an end-of-scope marker.
    • I've always thought qw() was kind of ugly, so I'd like to replace it with something prettier.
    • Angle Brackets Should Not Be Used for File Globbing. Indeed, they won't be. In fact, angle brackets won't be used for input at all, I suspect.
    • This allows us to simplify the special case in Perl 5 represented by the _ token, which was always rather difficult to explain.
    • The basic underlying question is "What exactly do those curlies mean?" For Perl 5 and earlier, the answer to that question was, "Too many things". Or rather, too many things with inconsistent rules.
    • curlies are so extremely overloaded in Perl 5
    • The old use integer pragma was a hack.
    There's more, but I got tired of skimming the Apocalypses.

    Just for a point of reference, I'm a perl programmer who doesn't fit your categories (a), (b), or (c), but still finds perl code hard to read fairly often.

    With all that said, I'll close with one more quote from the Wall:
    • Perl 5 does a lot of things right, and we're not terribly interested in ``fixing'' that.