Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Perl Programming

Damian Conway Publishes Exegesis 5 125

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."
This discussion has been archived. No new comments can be posted.

Damian Conway Publishes Exegesis 5

Comments Filter:
  • Re:back to school (Score:4, Informative)

    by IpalindromeI ( 515070 ) on Friday August 23, 2002 @08:43AM (#4125636) Journal
    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.
  • Re:back to school (Score:2, Informative)

    by jomagam ( 512625 ) on Friday August 23, 2002 @09:08AM (#4125710)
    Damian was illustrating advanced concepts in this article. Things are not going to get more complicated if you are a mid level perl programmer and never cared about zero-width positive look-behind assertions. Other good news is that perl6 is not expected to be production ready for at least 4 years; you have plenty of time to become a perl wizard.
  • by twoshortplanks ( 124523 ) on Friday August 23, 2002 @09:17AM (#4125745) Homepage
    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.
  • by barries ( 15577 ) on Friday August 23, 2002 @09:32AM (#4125807) Homepage
    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
  • by Masem ( 1171 ) on Friday August 23, 2002 @09:50AM (#4125912)
    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.

  • by admiralh ( 21771 ) on Friday August 23, 2002 @10:22AM (#4126070) Homepage
    Someone asked this very question at Damien's Pel 6 talk YAPC. According to Damien the "use CGI" (or whichever package) construct will tell the Perl 6 interpreter that the package being "use"'d is Perl 5 code. So the CPAN modules will still work.
  • by aytekin ( 266652 ) on Friday August 23, 2002 @10:22AM (#4126075)
    Because star can mean 0 to infinity. You are confusing "*" with "+". Plus would have meant 1 to infinity.

    @matches = $str =~ m:any/ah*/; # returns "ahhh", "ahh", "ah", "a"

    @matches = $str =~ m:any/ah+/; # returns "ahhh", "ahh", "ah"
  • by gorilla ( 36491 ) on Friday August 23, 2002 @11:00AM (#4126352)
    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 [perl.com].

  • Re:Ugh (Score:5, Informative)

    by jdavidb ( 449077 ) on Friday August 23, 2002 @11:12AM (#4126436) Homepage Journal

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

  • by Anonymous Coward on Friday August 23, 2002 @11:17AM (#4126485)

    By the way, it's "Perl," not "PERL." [perldoc.com]. The language is "Perl," the interpreter (the actual program itself) is "perl." Perl is not really an acronym (that was made up after the fact), so "PERL" is not correct.

  • by Elian ( 10270 ) on Friday August 23, 2002 @01:03PM (#4127391) Homepage
    Things are being taken in order. Each Apocalypse corresponds to a chapter in Programming Perl 3e. We'll get to objects, never fear. They're just not next.

Genetics explains why you look like your father, and if you don't, why you should.

Working...