Slashdot Mirror


Damian Conway Publishes Exegesis 5

prostoalex writes "Come gather round Mongers, whatever you code, And admit that your forehead's about to explode, 'Cos Perl patterns induce complete brain overload, If there's source code you should be maintainin', Then you better start learnin' Perl 6 patterns soon, For the regexes, they are a-changin'. This remix of Bob Dylan serves as an epigraph to Exegesis 5."

18 of 125 comments (clear)

  1. Monty Python and the Holy Grail Sinking Castle by SimHacker · · Score: 4, Funny
    Perl is like the castle built by the king in Monty Python and the Holy Grail, that fell over and sank into the swamp. So he built another one. And that fell over and sank into the swamp too. And then he built another and another, and they all fell over and sank into the swamp. Then finally, he built a really big one, and that burned down, fell over, and sank into the swamp.

    -Don

    --
    Take a look and feel free: http://www.PieMenu.com
    1. Re:Monty Python and the Holy Grail Sinking Castle by IpalindromeI · · Score: 4, Insightful

      It does kind of feel that way. Since all previous versions have worried much about maintaining backward compatibility, a lot of new stuff has been added without removing the old stuff (merely deprecating it). Because of the "history" behind things. With Perl6, though, they're ripping everything apart and rebuilding it from scratch, using the experience and wisdom that have been gained over the years. What was good and we'd like to keep? What was bad and should be done away with? What was a nice concept but implemented poorly? These are the questions the designers are asking themselves. I think something people are dreading is that since this is a total rewrite, looking more towards Doing It Right than making sure it still works like it used to, there will be much to relearn. But personally I'm glad they decided to do it this way, because it means they can do exciting things, and get rid of annoying things, and not have to worry about the compatibility. In the end, I think it will turn out to be a much cleaner, more consistent, more powerful, and even friendlier Perl. It will be like a breath of fresh air, and each Apocalypse gives more to be excited about.

      --

      --
      Promoting critical thinking since 1994.
    2. Re:Monty Python and the Holy Grail Sinking Castle by mshomphe · · Score: 3, Insightful
      Perl is like the castle built by the king in Monty Python and the Holy Grail, that fell over and sank into the swamp. So he built another one. And that fell over and sank into the swamp too. And then he built another and another, and they all fell over and sank into the swamp. Then finally, he built a really big one, and that burned down, fell over, and sank into the swamp.

      Don't forget, the last one stayed up. And it was the strongest castle in all of Britian.
      --
      She sat at the window watching the evening invade the avenue.
  2. Ugh by Your_Mom · · Score: 4, Interesting

    I was excited for Perl 6 when it was first starting out, then I reading about all the stuff that is going to change, and got worried. Now, after reading this, I've come to the conclusions that I am sticking with Perl 5, as for my Web stuff, I'm finally taking theplunge and learning PHP. Perl 6 is starting to become a completely different language, all y stuff works now, and I don't feel like porting.

    --
    Objects in the blog are closer then they ap
    1. Re:Ugh by Dom2 · · Score: 3, Insightful

      If you don't like it, you don't have to port it.

      There are still people using emacs 18 to edit their files because it's small and it works.

      There are still people running Windows 98 to run their games because it works.

      Nobody's forcing you to move to Perl 6. That's the beauty of Open Source. Perl 5 is going to be developed for a long time to come. Don't give up hope.

      -Dom

    2. Re:Ugh by jdavidb · · Score: 5, Informative

      You might want to have a look at this article which highlights some of the ways in which Perl 6 is not changing.

  3. Re:back to school by IpalindromeI · · Score: 4, Informative

    You'll still be able to use Perl5 regexes by indicating a special flag to the regex engine. So you don't have completely jump right in from the start. But from reading Apocalypse 5, Perl6 regexes look to be much much cooler. So you'll probably want to learn them anyway.

    --

    --
    Promoting critical thinking since 1994.
  4. What does this mean for CPAN modules? by shoppa · · Score: 4, Interesting
    It's good that many things that formerly required CPAN modules (e.g. recursive-descent packages) will be "built-in" to Perl 6. But will all the syntax changes mean that there will be a delay between the release of Perl 6 and all the CPAN modules catching up?

    CPAN is a powerful resource. If all those modules get left behind, I fear we may end up with a more eloquent language in Perl 6 but with substantially less usability.

    1. Re:What does this mean for CPAN modules? by Masem · · Score: 3, Informative
      Elsewhere on this thread, someone posted the relative question from the Perl6 FAQ. Basically, Perl 6 creates a virtual bytecode engine, and the front end interpreter includes one that converts Perl6 to this engine, and another that convert Perl5 to this engine. From a programming POV, the distinction between a Perl6 and Perl5 program will be the inclusion at the first line of code of a keyword in Perl6 that's not in Perl5; if the interpreter sees that keyword first, it will treat the source as Perl6, otherwise Perl5.

      Since most existing CPAN modules lack this keyword they will all run with the Perl5 interpreter. There may be some oddities with modules that use native code or other odd features, so obviously there will be a testing phase.

      Additionally, at least for OOP-type modules, everything you can do with objects in Perl5 can be done to objects in Perl6 (albeit with minor differences in the syntax), so and Perl5 module should work cleanly in a Perl6 codeblock. Obviously, since Perl6 objects have a bit more power, you can't necessarily take those back to Perl5.

      Of course, there will probably be some mechanism to update CPAN modules from Perl5 to Perl6, leaving the Perl5 version in place, but exactly how this is do be done, it's way too early to tell.

      --
      "Pinky, you've left the lens cap of your mind on again." - P&TB
      "I can see my house from here!" - ST:
    2. Re:What does this mean for CPAN modules? by gorilla · · Score: 3, Informative
      From a programming POV, the distinction between a Perl6 and Perl5 program will be the inclusion at the first line of code of a keyword in Perl6 that's not in Perl5; if the interpreter sees that keyword first, it will treat the source as Perl6, otherwise Perl5.

      This will be for modules, not programs. A Perl 5 module begins with 'package Acme::Foo;'. A Perl 6 module will begin with 'module Acme::Foo'. This is explained in Exegesis 4.

  5. Perl6 FAQ by ajs · · Score: 5, Interesting
    Perl 6 is a big scary beast that sets people off in a lot of ways. Let me try to answer some of the big questions:
    • Why is Perl changing so much?!

      Because it needs to. Perl is the legacy of something like 15 years of development and evolution. It started as a simple text processing system, and is now used in every field of endevor where computers are used. There are some old things that needed to go, some new things that were needed and generally a need to re-examine the way "stuff" was done.

    • But what about my programs? Why break them?!

      Perl 6 is two things (at least): a parser for Perl 6 and a back-end virtual machine, much like Java or C#. One of the design criteria for the release of Perl 6 is a Perl 5 compatible parser front-end that outputs Perl 6 virtual machine bytecode. This means that your Perl 5 programs will run with no modification in a Perl 6 environment (or at most a path change to the interpreter, that much is still under some debate).

    • Why would you want to break compatibility with other regular expression engines?

      Remember that Perl has been leading the pack in terms of regular expression handling for a long time. Now Perl is moving beyond regular expressions to grammar specification. This is a good thing, as long as the benefits of regular expressions are preserved.

    Some of this will be good for everyone. Some of it some of you won't like, but a lot of it you will. Give Perl 6 a chance, and don't react as if we've shot your pet.
  6. Re:skimmed the article by twoshortplanks · · Score: 5, Informative
    1. A regular expression is, and always will be, a way of creating a rule engine/fine-state machine. It's a type three grammer. There are simple maths proofs that can demonstrate this
    2. A finate state machine cannot match XML. XML requires you to have the ability to match the right number of opening and closing brackets (and to do that you need to be able to store the number you've seen somewhere.) This requires a push down automina - a stack machine - a type two grammer.
    3. Perl's "Regular Expressions" have been beond a true regular expression for quite a while now (see backreferences)
    4. Perl 6's rule system - let's dump the term regular expression now - is a further step in this complicated matching.
    5. Matching type two grammers - like Parse::RecDescent can - is a good thing.
    --
    -- Sorry, I can't think of anything funny to say here.
  7. Beautiful! by soboroff · · Score: 3, Insightful

    I only had time to skim the article, and anyway it would take anyone a while to absorb all that code. Here's the short summary:

    Regex's in Perl have accumulated too much cruft to be called regular expressions anymore. So now they're full grammers.

    That's right. Now you can pattern match with a very readable grammer syntax that is easily decorated with Perl code to do parsing. YACC for Perl. You can find packages for this on CPAN, but this is integrated with the language.

    No whining about the bad old days of Perl regex syntax for me... now I'm actually excited by the prospect of needing to buy a new llama book.

    1. Re:Beautiful! by merlyn · · Score: 3, Funny
      now I'm actually excited by the prospect of needing to buy a new llama book.
      Well, I certainly can't complain about that.
  8. Perl 6 will be largely backward compatible by barries · · Score: 5, Informative

    People--especially FUDchunkers--are missing the most important points:

    Almost all of the most useful Perl5 code of today will be runnable by Perl6 tomorrow: the compiler will fall back to perl5 and the VM is language neutral (even moreso that .NET it would seem).

    In addition to running most perl5 modules as-is, Perl6 matching rules will have a perl5 backwards compatability mode built in so you can continue using the Perl5 regular expressions you know and love from Perl, Java, and everywhere else that's adopted them as needed in Perl6 code.

    Yes, Perl6 is a rewrite and introduces a lot of deep CS concepts and ew syntax, but some care is being taken to assure that most Perl5 code will be runnable as is, while people learn about the power of some of the advanced tools Perl6 will provide.

    Please Don't Panic (or incite others to): the apocolypses and exegises are technical documents, they are not meant to be smooth, easy reading or to reassure today's perlers that their hard won skills will be useful. They're meant to describe what's new and different and usually why. Don't be scared by the new and different, just as with existing Perl, you should be able to adopt the powerful new concepts and syntax as you need to without having to swallow it whole or unlearn everything you already know.

    Perl6 will be stunningly more powerful, expressive, and provide (optionally) the safety features required for average coders to implement large systems while letting experts use extremely powerful tools like closures, continuations, intricate pattern matching that have mostly been accessible in academic languages to this point. And it will still allow convenient scripts to be generated if that's what you need to do.

    Remember folks, other languages can make shitty code smell nice, but it's still shitty code and you wouldn't want to eat^Wmaintain it.

    - Barrie

  9. Wow. A perl 4 geek's summary by dschuetz · · Score: 5, Interesting
    [preface:
    I first used perl back in version 3, something like 12 years ago. I first really learned perl, v4, about 9 years ago. It did everything I ever needed.

    Then, perl 5 came out. I didn't bother "learning" it -- that is, I've been using it, and when I really need to, I've used some perl 5 features, but I've learned them as I go (by example), and I know I'm not really using the full capabilites. (plus, though I know what I'm doing, I don't always know what to call what I'm doing -- I got stumped the other day when someone asked me how to do pointers in perl. I drew a blank, not making the connection to all the weird hash magic I'd been doing lately. But I digress.)

    Anyway, the bottom line of this is: Perl 5 looked interesting, but like more of the same, and wasn't really compelling for me to buckle down and learn all the new features. Perl 6, on the other hand, scares me. In a good way.


    Here's a page-by-page description of how I read the article:
    • Page 1: Hm. Looks like they're describing a grammar with regex. Cool.
    • Page 2: I can intuitively match against a set of strings! Wild. These strings can be expressions themselves? Even better!
    • Page 3: It's a grammar. A full, honkin, real, honest-to-goodness grammar. That I can match against. Are those angels I hear singing?
    • Page 4: <head explodes>
    • Page 5: <drools>
    Seriously, though, I was concerned at first that I'd have to learn something new, crazy, and difficult (given how screwed-up much of perl 5 has seemed, at times). I'm impressed. I'm very impressed. Yes, I have to learn somthing new and crazy, but it's not at all difficult. In fact, I think I've already learned it.

    The power that this new system holds, and, more importantly, the simplicity of it all, is amazing.

    So, unlike some other posters, I can't wait for Perl 6. When does this come out, again? And, more importantly, when can I buy the new book?

    (also, was I the only one who expected, after the demonstration of matching method invocations, to be told that the entire source code for perl6 was just one giant RegEx/Grammar?)
  10. Let me get this straight by Camel+Pilot · · Score: 4, Insightful

    You are upset that Perl 6 is changing significantly enough that you feel it could be classified as a different language. And you don't want to learn a new language so to solve your dilemma you are going to learn a different language? :)

  11. Re:Wow. A perl 4 geek's summary by ajs · · Score: 3, Interesting

    was I the only one who expected, after the demonstration of matching method invocations, to be told that the entire source code for perl6 was just one giant RegEx/Grammar?

    That's correct, and has been Larry's plan since the beginning. The Perl6 eval will be a rule like so:

    if /^<$code <perlgrammar>>$/ {
    Parrot.execute $code.bytecode;
    }

    Add command-line handling and that's your /usr/bin/perl in a nutshell.