Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Perl Programming

Apocalypse 5 Released 253

Simon Cozens writes "The Apocalypses are Larry Wall's explanation of the design of Perl 6. In Apocalypse 5, Larry turns to redesigning regular expressions. He set out to intentionally 'break' a lot of the regular expression culture we're all used to, and these are the results - and they're mindblowing."
This discussion has been archived. No new comments can be posted.

Apocalypse 5 Released

Comments Filter:
  • Regex (Score:4, Insightful)

    by inflex ( 123318 ) on Wednesday June 05, 2002 @05:44AM (#3643755) Homepage Journal
    Why do we always have to keep changing regex [and many othe things]. Isn't enough that we have to learn one format for almost every language. Sure, there are perhaps easier ways to express certain logic situations, but over all, do we /need/ another regex format?
    • Re:Regex (Score:3, Insightful)

      by joeykiller ( 119489 )
      Perhaps we need to change regex and a lot of other things because the way they work today is not too optimal, or even logical (not that Perl itself is) or intuitive.
    • Re:Regex (Score:5, Informative)

      by jaffray ( 6665 ) on Wednesday June 05, 2002 @01:12PM (#3646628)
      Yes, we do need another regexp format. Larry spends several pages explaining why, if you'd read the article.

      Furthermore, 80% of your existing Perl5 regexps will work unchanged in Perl6. *, +, *?, +?, (), ?, all unchanged. Most of the backslash-letter character classes, unchanged. Dot and ^ and $ are the same for most purposes, trivial to port when they aren't. 80% of the remaining cases can be ported by changing [] to <[]> and escaping spaces or replacing them with \s or \h (which they often should have been anyway).

      I'd rather spend half an hour every fifteen years to learn something new than put up with the inferior old scheme for another decade or more. Unreadability of regexps is one of the biggest complaints people have about Perl, and this addresses those concerns head-on.

      (Incidentally, people made all these same complaints the last time Perl changed regexps, when Perl5 came out. And now virtually every other popular language has recognized that the Perl5 design is better than its predecessors, and has adopted a Perl-compatible regular expression syntax or library. Larry's got a pretty good track record here.)

      (BTW, the preceding incomplete post was a slip of the mouse. Mods, please kill it.)
  • by somethingwicked ( 260651 ) on Wednesday June 05, 2002 @06:06AM (#3643792)
    He set out to intentionally 'break' a lot of the regular expression culture we're all used to

    I hope he can break "Don't go there" and "Talk to the hand" There are many others, but this would be a good start
  • by distributed.karma ( 566687 ) on Wednesday June 05, 2002 @06:13AM (#3643804)
    So, when Perl 6.final is released, will the release notes be called "Apocalypse.Now"?
    • Yeah, and by the last few Apocalypses, Larry will have shaved his head and gained a lot of weight, and he'll sit in the darkness muttering half-profound, half-obvious statements about language design. And Damian Conway can play the Dennis Hopper role, the drugged-up photographer/court jester :) But who gets to be Marlowe/Willard?

      ObDisclaimer: I really like both Apocalypse Now and Perl, but they seem uncannily similar now that I think about it -- that great epic attempt to render the human condition, that falls well short (but at least tries :)...

  • New regexes (Score:5, Insightful)

    by Dacmot ( 266348 ) on Wednesday June 05, 2002 @06:15AM (#3643810)
    The new perl 6 regexes are crazy. They seem "weird" and awkward compared to the perl 5 ones... but then again I thought the same when I started learning perl (at version 5.6).

    A lot of this makes a lot of sense however, especially the default /x to allow for easier reading of code and allow for comments inside the regexes. Some of the new features make the regexes a bit longer to type, but in general they are significantly smaller. There's also a much better and more consistent use of different types of brackets. Not having to look at the end of the regex to understand the whole thing is going to be great. I hate having to skip the regex to look a the flags first.

    Brilliant I think. I can't wait for it to come out. I hope they make a perl5->6 translator though :o) I also wonder what the speed of the interpreter is going to be like compared to perl5. Hopefully faster :o)

    Good job Larry, Damian et al.

  • by 00_NOP ( 559413 ) on Wednesday June 05, 2002 @06:21AM (#3643836) Homepage
    Something to make the code that little bit more unmaintainable. That keep those PHP whores on their toes :->
  • by ajm ( 9538 ) on Wednesday June 05, 2002 @06:37AM (#3643883)
    For instance there is now OO COBOL but the only people that use it are COBOL programmers who are stuck, perhaps because of their company's dictates, perhaps by choice, with COBOL. In the same way perl may be heading towards irrelevance wrt "mainstream" language. I've written commercial perl in the past, it was a pain then and it's still a pain now. The thing is that now there are alternative languages in the same space (python, ruby etc., php for web side) that do the "perl thing" better than perl.

    Perl was great, it introduced many people to programming, just like COBOL did. But now it's time to move on. To move on to languages that learnt from perl, that improved on it, that don't have to drag around a syntax and culture that values neat tricks and trying to guess what the programmer really meant over providing the needed building blocks and letting you build code that does what you say, not what it thinks it heard you say. Or even, dare I say it, to move on to languages outside the perl family for some programming and choose the right tool for the job for a change.

    I'd prefer to think of this as provocative rather than a flame, there is a difference you know.
    • People use COBOL (Score:2, Interesting)

      Wherre I work I'm almost the only non-cobol programmer. We are developing modern data wharehousing solutions, for huge amounts of data, using mainframes , DB II and COBOL.
      Cobol has been arround for such a long time that it is known good solution, the same thing applies for Perl and CGI.
      Would you trust you life on an App writen in VB, or a large C++ /Java 1.4 system.
      C++ is to complex for everyday usage, sure it's got great performance and flexability, but one of it's downfalls.

      VB is just a glorified scripting language, with loads of bugs and much crapness, i should know i've been [had to] using it for 7+ years.

      Java just insn't mature enough for anything decient.

      So were left with Perl, Cobol and the like
      • by ajm ( 9538 )
        I agree, I've used COBOL myself. For what we were doing with it when we were doing it it was the best choice, in fact probably the only choice. That's not the case anymore, just like it isn't with perl. I can see why you're sticking with COBOL, though I'd look at Java as it's probably now the data processing language of choice. I wouldn't rate perl as highly as COBOL wrt its fit in its space anymore. As to Java's maturity, I think you're under rating it pretty heavily. It's mature enough now. btw I imagine you're shop will never use .NET if maturity is a criterion, and rightly so.
        • It's just that version 1.4 has just started to add maturity to Java i.e 1.3 java was a bit hmmm.. imature, 1.3 fixed a lot of things, 1.4 has beefed Java up a lot so 1.5 or so would be Matureish. ie. Most of the bugs and incosistancies should be ironed out.

          The same thing is happening with linux, 2.6 kernel is starting to get maturity features in it, so by that reason 2.8 or 3 should have ironed out the bugs/inconsistancies in the maturity features.

          (linux is however great for custom applications)
      • Java just insn't mature enough for anything decient.

        Right. So all of the following companies are just about to fall down:

        CIBC

        Bank of America

        Standard Bank

        Sallie Mae

        And that was just part of the client list from the first hit that came back when I typed in "Java Banking."

        Bunch of failing loser companies, aren't they?

        -jon

        • Of course not. They just have to put a lot of extra effort in to deal with Java's immaturity and spend more on a the solution than they'd have to. They could write everything in INTERCAL such that it worked and was very robust. It'd just be a pain in the ass.
    • As a developer who has done a reasonable amount of Perl and Java, the choice of when to use one or the other is becoming more and more interesting.

      Sometimes, it's just a matter of environment: the places I host my websites have Perl available, (sometimes Java, but it's more of a pain) so that tends to be my first choice.

      There's a lot to be said for the convenience of Perl. Edit code, save, and run has benefits greater than you'd expect by just seeing that edit, save, compile, run is one extra step. (And pushing that one step further, the sheer # of files is one of the things that's a huge drawback to EJBs...)

      And of course there's what the language makes simpler. I know there are Java classes that give it full Perl regexes and the like, but somehow they seem evil to me. I don't like to go crazy with the Perl syntax shortcuts, but being able to so easily open up files and the like, and not have to jump through hoops to read a line at a time...there's a lot to be said for that.

      On the other hand, OO in Perl is pretty disgusting to anyone who grew up with objects in C++ and Java. It even makes PHP's object syntax look normal.

      So, in the end, I don't know. It certainly seems easier to sell my Java skills in today's ugly jobmarket, and it certainly seems easier to update my personal websites in Perl. For now, I guess I'll be keeping up my skills in both.
      • Java's regexes seem evil to you for a good reason. Java isn't extensible, so you can't add lovely syntax for regexes, which do much better with a special syntax to accomodate them.

        For example, I was reading some Java2 1.4 docs, where they were gushing over the new regex libs.

        In perl, you'd say something like:
        $s = "howdy partner";
        if ($s =~ /howdy/) { print "yay!\n"; }

        In Java:
        String s = String new("howdy partner");
        Regex r = r new;
        r.compile("/howdy/");
        if ( r.match(s) ) {
        System.out.print("nay to java!");
        }

        Christ, that's ugly.

        I'm not a Java or perl programmer, so this won't compile, but the gist of it is there.
    • I certainly agree. Perl doesn't 'feel' right, it feels/looks contorted somehow, a square peg trying to fit into a round hole and all that --yes, I know awk and sed and ksh and I wouldn't want to program a big web app in any of them or a blend thereof.

      I am a Python fan and I can readily admit to some Python weaknesses, but overall Python feels cleaner and predictable. For instance, Python already has changed regexes; but because they don't come built in to the main language syntax (as they shouldn't; not everything is about text), it was a painless transition for everybody involved. I am sure that if Perl6's regexes gain acceptance, there will soon be a new Python module to accommodate them.
      • For instance, Python already has changed regexes; but because they don't come built in to the main language syntax (as they shouldn't; not everything is about text), it was a painless transition for everybody involved.

        perl is the practical extraction and reporting language. that's what it was originally designed for, and it's still extremely useful for that. just the other day i had to rip some statistics out of the debug output of a program, and average it together over multiple tests, outputting it into comma separated values. perl was incredibly useful for that. not everything is about text, but perl is designed for the cases where it IS about text.

        perl only really starts to fail when you consider it a panacea. it will not do everything for you, and there's some things that it just plain sucks at. all languages are the same way -- they have strengths and weakness. perl will extract your data, and it will act as a quick scriupting engine, for when shell scripting just isn't powerful enough. just don't try to write an officew suite or anything in it.

        • perl is the practical extraction and reporting language. that's what it was originally designed for

          Arguably that's what it was designed for, but that's a "backronym" (hey, how do i create e2 links in slashcode?). perl was "pearl" in larry wall's mind, but through some weird quirk of the library filing system, he only had four letters, so he called it PERL (all uppercase then, I think). Which was helpful since there was another language at the time called "pearl" (which never took off anyway).
    • You know what, you're right. Just not as right as you might think. Anytime a new language comes around, people try to use it for everything. Witness Java. When Java came out it was crowned the Best Thing Since Sliced Bread(tm), and everybody tried to use it for *everything*. Well, guess what. It didn't work that well in all those apps. Java found a niche and lives on quite well.

      Perl is in the same position. It's coming of age. People are realizing what it's good for and what it's not. Perl is NOT IN ANY WAY like COBOL. COBOL is an anachronism that stays around because of inertia. Perl is a language that is just going through growing pains.

      While I applaud LW's ideas for Perl 6, I'm not sure that I would make such wholesale changes. There are going to be LOTS of people that stay on 5.x because they don't want to port, which may cause a maintenance nightmare.

      Ben
      • I'd dispute this. In some places Perl is just hanging around because of inertia the same way COBOL is. If you've got a bunch of perl code you're likely to write new stuff in perl because you can't rewrite all your existing stuff in some other language, even if that other language is better. But, if you're starting a new project, other than a quick hack, would you really choose perl, just like would you really choose COBOL. I wouldn't for the same reasons in both cases, there are now better choices available.
        • The quick hack is where perl is great though. For example, I wanted a quick hack to send myself SMS messages through a web gateway. Toss in LWP::UserAgent, and blammo, I have a short script that crops the message to sms length, connects to the server and fires it off.
        • by ekidder ( 121911 ) on Wednesday June 05, 2002 @09:05AM (#3644563) Homepage
          We use perl pretty much exclusively for my work (telecommunications company). It's not that we have inertia (in fact, the company standard is Java - ack), it's that we LIKE perl. It has the right combination of features that makes just about everyone in the group happy.
        • What's the point? Java, C, C++, COBOL, Mantis, VB, you name it...even Ada. The point is not whether something is bad because it has become such a widely used language that it has legacy code dating back to a few generations, but whether it serves a useful purpose.

          People (especially on /.) will argue that COBOL or FORTRAN or what have you is obsolete because it isn't the latest, sexiest language. That's not a valid argument. COBOL finds uses in every day environments that maintain our IT infrastructure...in places most people wouldn't even notice.

          The same thing goes for Perl. It may not have the newness of Ruby, and it may have code dating back to release 4 on web servers the world over, but that doesn't mean it is dated or that it is time to scrap the language.

          One of the nice things that Perl has going for it is the modularity. You go to CPAN, download a new module, and all of a sudden, your toolbox has a whole new tray of useful tools that save you from re-inventing the wheel. These tools let you perform system administration tasks, provide CGI applications with ease, or handle back end tasks. It is more powerful than shell scripting and more flexible than C/C++/Java.

          As much as I'd like to think you're being reasonable, it seems to me you've made a blanket, baseless statement. If you want to provide some evidence that your point of view has merit, I'm sure we'd all be interested. In the meantime, you're likely to be dismissed as a troll....
          • CPAN-style modularity comes at the price of security.

            ajm isn't talking about dumping perl to use C/C++/Java. You're right in your comparison of perl to them, but I say dump all but C, which you use to write the better languages until said better languages are completely self-hosting. :P
    • I'd prefer to think of this as provocative rather than a flame, there is a difference you know.

      There is in fact a difference. Unfortunately, you're really not on the right side of it. For example: "Or even, dare I say it, to move on to languages outside the perl family for some programming and choose the right tool for the job for a change." That's not provocative, that's just insulting to those who like perl and who think that there are many jobs for which it is the right tool.

      You see, provocotive is bringing up ideas that people have not thought of before. Everyone having once been five years old has thought, "does this suck" before, about prettymuch everything. Thus posting "consider that perl sucks" is not provocotive. Noone who learns a programming language doesn't consider, at some point fairly early on, "does this suck".

      So while you would prefer to think of your post as provocotive, really it's just a flame. It's also fairly wrong, too, as perl is quite far from irrelevant. It's also most certainly not a universal solution, but then nothing is.

      And besides all of this, Perl 6 is going to be a language which learned from Perl 1-5, so it's still one to be compared even if one slavishly follows your post.

      • I don't think it's wrong to like perl and there are certainly jobs for which it's the right tool. But you need to pick which jobs they are, which is what I meant by "choose the right tool for the job".

        I've used perl extensively myself in the past and I use it today for knocking up quick scripts. I certainly didn't state that perl sucked, I don't think COBOL sucks either. For what they are useful for they are very good, unfortunately for them the number of things for which they are better than the alternatives is getting smaller and smaller as time goes by.

        As for provocative, it means to provoke, in this case a discussion, and it did that. To flame is different.
        • Provoking a flamewar is still considerably different from provoking thoughtful discussion. Saying "Perl sucks, let's find a new language" is a flame. Saying "I think language X better serves the purposes Perl addresses" is thoughtful and provocative. See the difference? Unfortunately, the parent thread came down on the "Perl sucks" side of things...
          • So far I've not seem a flamewar. I've seen some thoughtful, more or less, discussion. I didn't say "Perl sucks, let's find a new language" I said "perhaps perl's time has passed, what do you think of that", and some people thought about it. Others got hung up over the difference between provocative and flame, but that's their perogative.

            Also, to get any attention for a posting on slashdot it helps to have a "provocative" title and just saying "I think language X better serves the purposes Perl addresses" is as likely to provoke a flamewar as anything. With your user number you should know that. People here have their itchy trigger fingers on their flamethrowers all the time. The only advantage over kuro5hin is the larger audience (perhaps you'll take that as a flame also :).
            • I don't have a use for kuro5hin, so I don't consider that a flame.

              I do still wish there had been more subject matter in the original post that people could consider... free response to an ambiguous post is a two-edged sword...and on slashdot, that ambiguity is likely to result in getting cut with both sides of the sword :)
              • I agree. In defense I'd like to say that it was pretty early in the morning for me :)

                I used to use perl a lot but even with the best of intentions I ended up with code that I found hard to maintain. My bias is now towards more verbose languages where there is only one way to do things, certainly for "mixed ability team corporate projects". Btw that's one of the things I dislike about .NET, the choice of languages. For some projects I've worked on the fewer choices people had the less trouble they managed to get themselves into.

                For perl alternatives I'd probably pick python these days for simple and not so simple scripting, java for corporate programming or open source where you want lots of contributers, scheme/lisp for fun, and standard ML or Haskell for new perspectives.
                • That's a more meaty response :)

                  I've used Ada for school projects, JavaScript and Perl in corporate environments (I've only been out for a couple of years), and had classes in C, C++, Lisp, Scheme (there *is* a difference), x86 ASM, and (theoretically) Java. (I could include Apple Basic in the list, but it really doesn't apply).

                  The JavaScript was used in both server- and client-side applications (my last company was a BroadVision shop), and I certainly appreciated the OO, one-way approach it offered. It was also considerably easier than my experiences trying to learn Java. Maybe it's just me, but I found that compared with Ada (another strongly-typed language) that Java was a real pain to learn. I've heard all the arguments about its robustness, built-in OO, etc., but I find it difficult to justify using it as an all-around tool, and even have trouble with the idea of using it for CGI applications.

                  I've forgotten a lot of my C/C++ syntax (writing too much Perl code ;)), but I certainly understand why you'd use that for application and system programming over, say, Java. (Perl really isn't designed for those tasks, although it is useful in a web-based ASP model).

                  I still don't quite get the Lisp and Scheme obsession. Yes, it is certainly novel to be able to have a program recurse on itself and create its own anonymous routines, but the code is nearly unmaintainable and unless you take drastic measures, quite unreadable.

                  I haven't used Python, but from what I've heard, it could probably do good service in some of the same areas Perl does. I guess my biggest point is that Perl is so flexible that it saves you from having to know a dozen different languages to do a dozen different things. It certainly isn't an end-all language; there are limits to anything, even to a language that tries to do (almost) everything.

                  You did mention that you disliked Perl because you ended up with code that was difficult to maintain. However, that isn't a Perl limitation. It is a design limitation. If you carefully write readable Perl code and leave plenty of comments...and you use a well-thought, easily extensible design to begin with, the code won't be such a beast to keep up. This is why they have Software Engineering courses at University :) Of course, I'll admit that most people don't design very carefully, but, as I said, that isn't a language limitation.
                  • Yep, Lisp and scheme are different. The three things I'd say make them stand out are

                    1. Macros: especially in scheme. Fantastic way to extend the language and meta program

                    2. Tail call elimination in scheme: Using recursion instead of looping can often make the intent clearer and tail call elimination makes it cost the same as looping.

                    3. Closures: call/cc is amazing

                    I agree that unmaintainability is mostly a design issue (otoh you say lisp/scheme is unmaintainable, isn't that the same situation) but some languages help it and some hinder it. I feel that perl hinders it by providing different syntax for things with insignificant semantic difference.

                    Lisp/scheme readability is also a design issue but is greatly helped by auto indenting editors.
                    • Lisp/Scheme unmaintainability is (IMHO) a direct result of the structure of the language, at least, from my experience. When the entire 'program' is embedded in a single expression, you sometimes have to rewrite entire parts of the expression to change a trivial amount of functionality. One of our ongoing class assignments in Scheme was to make a grammar parser, and the changes that the professor showed from stage to stage as the assignments progressed were fairly major.

                      Perhaps part of my bias against Scheme and Lisp is due to a lack of intimate understanding, therefore what appears unmaintainable to me really isn't, but I'm not sure of that. It seems far easier to maintain code written in a language where you have discrete graspable constructs than code written in a language with almost none.
                  • Lisp unreadable? Once you learn the syntax - (function arg1 arg2 ... argN) - it seems pretty damn simple to me. Unless you write your Lisp programs all on one line, like those Obscuf-perl people, it's quite readable. In fact, that's what emacs is for. Indenting Lisp code.

                    Personally, I like having 1 main syntax rule over having 200 little annoying ones. It means I have to learn less to get the same amount of work done. Some people like a fruitless challenge like learning an obese syntax, and that's fine. Not me, though.


                  • I still don't quite get the Lisp and Scheme obsession. Yes, it is certainly novel to be able to have a program recurse on itself and create its own anonymous routines, but the code is nearly unmaintainable and unless you take drastic measures, quite unreadable.



                    Like most other languages they are only nreadable if you don't know how to read it. Grok a language and reading it isn't difficult.


                    I prefer functional languages over any others when writing code. Functional languages in general are best suited to situations where you want to be as far away from the details of coding as possible and concentrate soley on the algorithms and Computer Sciencey aspects of what you're doing. At work, I prefer the mixture of Perl, C, and Java, depending on the application, because more people know them (not exactly a good reason) and they tend to work the best on the kind of things I do at work. In general the power of LISP (and other functional languages) just isn't needed at work.

    • I'd prefer to think of this as provocative rather than a flame, there is a difference you know.

      It would have been provocative had you given us some examples of languages that might replace Perl for sysadmin and CGI tasks, but you didn't, you just flamed Perl.

      So please list these languages I should be using for CGI. And no, I won't use PHP, the glorified mix of Perl and HTML.
      • I still disagree with the parent flame, but I think Mason really does a service handling at least the CGI tasks. On the sysadmin front, I have no idea, since Perl is my hammer :}
      • It's meant to provoke thought and discussion, which is it doing, well discussion anyway. Do you have any suggestions? Perhaps you like perl, why? perhaps you don't, why?, which language would you choose and why? I did actually suggest python or ruby as possibilities.
    • Learning from previous perls is exactly what Perl 6 is doing.

      Why should everyone put up with Python or PHP just because you've deamed perl old news? How do python, ruby or php do what perl does better? They don't. They do a few things differently, but they're all very similar and very much in the same mindspace. If you're going to abandon perl, you're not going to find anything revolutionary in those languages. Useful like perl they are, but they're nothing new.

      Frankly, I'm not much of a perl fan, and I only use it when I have to do so to keep from being forced to use something like C, C++, Java, Pascal, Python, or PHP. But it still can be quite useful, still has it's place and fans. So does COBOL, which is a good thing, because there are 6-million-odd lines of COBOL still running businesses, and it'd be a shame if at least some of those those stuck maintaining it didn't enjoy it.
      • Smalltalk is good too. Personally I'd like to use scheme, or maybe goo but that's very new at the moment. There are things about Haskell that are fantastic and the static typing in ML is great. There's lots of stuff out there with different mindsets but for a scripting task I'd choose a scripting language hence python or ruby.
        • Indeed, I use Smalltalk for almost everything, including scripting. I could do it in fewer lines in perl no doubt, but it'll take me 5 times as long to write. But then again, Squeak is basically my OS. I'm like one of those emacs people who have emacs as their OS- only smarter. (only because Squeak does more than emacs as far as end-user stuff! <duck>)

          I like Scheme because it's consistent. But it's so spartan, which can be a pain for real work. Common Lisp all the way.

          Still, there's not much of a difference between perl, ruby and python. Some syntax, even less semantics. Ruby seems definately the nicest out of them, but if you know perl, why bother learning it for almost no benefit? Rather, you'd take a hit in functionality, due to fewer libs Ruby has compared to perl.
          • I agree, little to choose between perl/python/ruby, but maybe learning a cleaner language first would help some people.

            On common lisp and scheme I prefer the simplicity of scheme "syntax". otoh I've not done commercial lisp or scheme and in that situation availability of libraries may be the deciding factor.

            Hey, are you dissing emacs, emacs rules, I love emacs/elisp :) I'll have to download and try squeak again. I did a few months ago and couldn't get "into" it, it's been a few years since I've done semi-serious smalltalk.
            • I too prefer the simplicity of Scheme. I've never done any huge projects in either of them, but even when writing scripts, the hugeness of libs in CL payed off. SLIB helps some, but it still is a drop of water in the bucket known as the standard CL library. CL is a bit bloated, but darn, those libs can sure be useful.

              Nah, I'm not dissing emacs. Just comparing myself to one of those people that do everything out of emacs. Except Squeak is a little more "normal" as far as UI is concerned. You know, windows, widgets, a mouse and all.

              Squeak can be a little hard to get into, especially considering how it doesn't integrate into the host environment much at all. That is, no native widgets, &c. But once you do, it's like the shackles of so-called "modern" operating systems have been taken off, and you're free to change anything in your environment. Sure, you could do so in Linux, but making a comparible change in C/GTK+ would probably take 10 times more time and 15 times more code. And at that point, why bother?

              Elisp is ugly (compared to Scheme and CL), but I'd rather have most of my editor written in elisp over C/C++ anyday.
    • The language of the future you describe - a language that learns from Perl, but doesn't have to drag around 15 years of built-up kludges and poor design decisions, a language which provides needed building blocks to write code that does what you say using the techniques most appropriate for the given job - is Perl6.

      Enjoy it.
  • Geez. (Score:5, Funny)

    by pokeyburro ( 472024 ) on Wednesday June 05, 2002 @06:57AM (#3643939) Homepage
    This feels sorta like God coming down and saying, "you know, I'm gonna rethink this whole carbon idea..."
  • Right at the beginning of the article, Larry Wall is already hinting at his background in linguistics. An article on adequacy.org [adequacy.org] questions the conventional wisdom that Mr. Wall's linguistics knowledge has any effect on perl. If you are familiar with the content on adequacy, let me tell you ahead of time that this is very different from their normal stuff. Interesting article.

    That said, I can suffer through Wall's writing style if it means I can learn how to do new regular expressions.
    • ... apparently he never noticed that Perl the programming language is not spelt Pearl.

      Not a typo on his part either, it's repeated several times, so I guess he's just not very observant about words and stuff, is he? Yep, a really reliable linguist you got there.
      • The "a" for "and" was subsequently dropped from the acronym ("Practical Extraction And Report Language"), in large part because there was already another language by that name ("pearl").

        People who wish to disparage perl and rile up its zealots will often spell it "pearl". It looks like the author succeeded here.
  • For the lazy.. (Score:3, Informative)

    by Gopher ( 24294 ) on Wednesday June 05, 2002 @07:06AM (#3643982) Homepage
    For those that don't want to read all 24 pages, the stuff that's important to most of us can be found on the top of page 6 [perl.com].

    The most common metacharacters have been preserved, so for the most part, you won't have to learn a new syntax for your regexs.

  • Damian Conway ... another perl luminati puts up an exegesis [perl.com] following each apocalypse. I find these much more readable and provide some really interesting code to ponder. Currently exegesis 5 is not out yet, but I'm sure we won't have to wait tooo long.
  • Great (Score:5, Insightful)

    by duffbeer703 ( 177751 ) on Wednesday June 05, 2002 @07:34AM (#3644077)
    So now Perl regexs are going to be completely different from every other language and more complex than ever... wonderful.

    I certainly hope that someone is going to be maintaining Perl 5. I certainly cannot see the Perl community moveing en masse to Perl 6, or whatever they decide to call it.

    • Re:Great (Score:2, Insightful)

      by jabberw0k ( 62554 )
      In the same way you still have to write in ancient versions of JavaScript and HTML because some non-zero percentage of your readership still uses Netscape 4.x, most of us will have to code in Perl5 for a long time to come.

      Why should Perl have forced upgrade incompatibilites like Microsoft Word? Arrgh.
      • Did you read any of the article? Or anything else relating to Perl 6?

        It's been made clear from the get-go that Perl 6 is going to be breaking things. The idea is to fix a lot of the issues in the language and hopefully move it out of the "write only language" category that it's been relegated to.
    • I can. There's not that many using Perl 4 now, is there? (Well, there are some, and so there will be with Perl 5 when Perl 6 comes out, but I hardly think the community will not move to Perl 6.

      And in case you need backward compatibility, I would be very surprised if you can't import a "perl5" module to get back to something more similar to perl5 syntax and semantics.

      • And in case you need backward compatibility, I would be very surprised if you can't import a "perl5" module to get back to something more similar to perl5 syntax and semantics.

        For what I've read in the past, it has always been the plan to ensure backward compatibility by defaulting to parsing Perl5-style syntax. Said another way, one must explicitly specify that a program is Perl6. This is a good thing, and a feature I'm counting on. There's quite a bit about Perl6 I'll probably not use very much. All I really need Perl for is a glue language. In fact, if I were to replace some chomp()'s with chop()'s most everything I've ever written will run under Perl4. I'm not quite as l33t as some although anyone can read my code. Needless to say, I don't post to perlmonks.org very much. :-)

        I don't think Wall will make everyone go back and re-write old code. That would be a grievous mistake.

        (Note: I haven't read the latest Apocalypse because perl.com seems to not be responding. If Wall has said anything to the contrary, then things have changed from what I've read in the past.)

        -B

    • In most ways, regexen will be less complex than ever, yet more powerful. Read Larry's rationale for changing them and let us know how he's wrong -- his reasons made a lot of sense to me.

      5 years after it's released, every regex library in existence will be compatible with the Perl 6 way of doing things, so you might as well start learning them now.
      • Re:Great (Score:2, Interesting)

        by bafu ( 580052 )

        In most ways, regexen will be less complex than ever, yet more powerful. Read Larry's rationale for changing them and let us know how he's wrong -- his reasons made a lot of sense to me.

        The problem is that there is a shitload of utility and cgi perl that will be broken if the perl on the server is upgraded. In some cases, like at ISPs, the code belongs to lots and lots of people that are totally unconnected from the administration of the site, so updating it becomes a nightmare. It's probably going to mean running two versions of perl (fortunately, perl doesn't take up a lot of space in /usr :-P ) and having to invoke it with version numbers... the normal messy drill.

        I'm sure that the changes will be great, but it's hard to get too excited since, I must confess, the current system didn't seem so horrible to me.

        5 years after it's released, every regex library in existence will be compatible with the Perl 6 way of doing things, so you might as well start learning them now.

        Obviously I will learn the new syntax. And I will update my scripts to work with perl6. Etc. Etc. The thing is, it looks like perl is going to be taking back a lot of the time it saved me in the past. Once I've paid that cost I may be able to forget about it, but at this point I'm looking at having to add something really tedious to my to do list. And it's not like I have a lot of thumb-twiddling time I can steal from...

        And here I thought Solaris was backward for not having embraced perl earlier than Solaris 8. Maybe it will turn out that they were [unintentionally, I'm sure] smarter than I thought...

  • ...is if Cmdr Taco is going to upgrade slashcode to Perl 6 and what he thinks of all this re-write of Perl.
  • by Second_Derivative ( 257815 ) on Wednesday June 05, 2002 @07:55AM (#3644173)
    ...that the active half of this Perl (5) powered site is completely screwed up at the moment? Improve languages all you want, it's still no substitute for decent sysadminning ;)
  • by riffraff ( 894 ) on Wednesday June 05, 2002 @07:57AM (#3644186) Homepage
    I Like this paragraph:


    However, I would like to think that there is some happy medium between those two extremes. Coming from a C background, Perl has historically treated regexes as servants. True, Perl has treated them as trusted servants, letting them move about in Perl society better than any other C-like language to date. Nevertheless, if we emancipate regexes to serve as co-equal control structures, and if we can rid ourselves of the regexist attitudes that many of us secretly harbor, we'll have a much more productive society than we currently do. We need to empower regexes with a sense of control (structure). It needs to be just as easy for a regex to call Perl code as it is for Perl code to call a regex.


    We've been discriminating against the poor regexes for too long. We need to represent them who are unable to represent themselves. Stop Regex Exploitation Now!

  • Will perl6 = ruby? (Score:3, Insightful)

    by Jeppe Salvesen ( 101622 ) on Wednesday June 05, 2002 @08:16AM (#3644285)
    I've asked this elsewhere. Ruby was designed with respect to perl, but all the same keeping to the principle of least surprise (which perl does not adhere to). Now, with Perl starting to look like a grown-up, mature language, what will the major differences between Ruby and Perl be?
  • He seems to be putting a lot of emphasis on embedding Perl inside regexps; while this will make them more powerful and allow you to do more complex things using them, it's increasing coupling between Perl regexp and Perl itself; I don't see the PCRE library and other similar libraries being able to keep up.

    Although he mentions he wants regexp to be taken more seriously as a tool for other languages, increasing coupling like this would seem to be a very poor way to go about it.

    The new-style regexp's reuse a lot of syntax from the standard regexps; the meaning of many common constructs have changed completely, but I can see it being difficult to actually notice the difference until you've already parsed part of it and gone "Uh?" a few times. And you're not just going to be able to forget about the "old-style" regexps.

    Personally I can't help but feel that Larry is the wrong person to make such large changes to the core regexp concepts; they're used heavily in languages other than Perl, but Larry is natuarally doing it in the context of Perl and to hell with any other language. For something so otherwise platform independent, I think this is a bad way to go.
  • my ($x) = /(.*)/ my $x; / $x:=(.*) /
    # may now bind it inside regex

    This is a feature that I hope is carried over into the scripting languages I use (PHP, Python).

    My first impression was that they may as well embed AWK in the regex engine.
  • Larry is mistaken if he thinks this is going to be in any way benefitial. All this does is change the syntax and add yet another layer of difficulty to what is already a mess.

    1) This isn't any easier to read. I've been programming since 1985 and went through more programming languages and idioms than I can recall, and regex is the only system I have attempted to learn and met with complete failure. If regex is to be redesigned (and despite my inability to learn it, I don't think it should be broken), at least make it comprehensible.

    2) This creates a giant rift in regex, with multiple, mutually incompatible versions across operating environments. What works on system A may not work on system B. Some vendors may choose to implement these extentions, and some may not. This is a disaster. Though regex may not have been completely compatible across systems up to now (and to be honest, I have no idea how compatible the various regex implementations are), adding yet another dialect can be nothing but bad.

    • 1) This isn't any easier to read. I've been programming since 1985 and went through more programming languages and idioms than I can recall, and regex is the only system I have attempted to learn and met with complete failure. If regex is to be redesigned (and despite my inability to learn it, I don't think it should be broken), at least make it comprehensible.


      I'm not trying to start a flame war, but regular expressions, both in theory and in practice are simple concepts. Perhaps you're in the wrong line of work? I'm betting that you are completely lacking in theory, which is odd, because in my experience the older a coder the more Computer Science they were exposed to, but I'm sure there are exceptions. Go pick up a book on finite state machines, actually you don't even need that, go read the FSA bits of the Dragon book.

    • StormReaver says: This isn't any easier to read.

      I'm glad I'm not the only one who thinks this... I absolutely HATE the idea of making /x the default.. To me whitespaced and commented regexps are an order of magnitude harder to read.. Let's say I want to match the phrase "this is a sentence". Here's the easiest perl5 way to do it:

      /this is a sentence/

      Now perl6:

      /this<sp>is<sp>a<sp> sentence/
      or: /this <sp> is <sp> a <sp> sentence/
      or: /this <sp>
      is <sp> # sentence's verb
      a <sp>
      sentence/ # YUCK!
      or: /this \s+ is \s+ a \s+ sentence/

      Maybe it's just my personal bias, but I think comments, newlines and whitespace should be left OUT of regular expressions.

      Shayne
  • by Saint Nobody ( 21391 ) on Wednesday June 05, 2002 @09:06AM (#3644567) Homepage Journal

    this guy [perl.org] has been doing some interesting work [perl.org] on the regex engine. he's added functionality so that you can have recursive regular expressions without the clumsy postponed subexpression ("(??{...})") mechanism. on the one hand, it's far less readable that way, but on the other hand, you don't have to predeclare a variable for every production rule in your grammar.

    and the current system is even more convoluted since the postponed subexpressions are evaluated in the environment in which they are checked, not where they were declared. this means that all variables referenced when you built the regex have to be in scope when you use it. that's a restriction i'd like to do away with, although i'd rather see it done by making postponed subexpressions support closures.

    as i recall there's also an rfc for perl 6 on the perl site to make a stack-based regex engine rather than stat-machine-based, so that it could support CFGs, but i don't think it specified how it would work syntactically.

  • Perl parsing Perl (Score:4, Interesting)

    by dannyspanner ( 135912 ) on Wednesday June 05, 2002 @09:10AM (#3644598) Homepage
    I've read comments by Larry to the effect that Perl is great at writing lexers but not parsers. If you look at some of the later examples (around page 11) it's clear that he's trying to make Perl regexes powerful/clear enough to parse Perl. They remind me of yacc/bison, which makes sense.
  • Dammit Larry ... (Score:3, Insightful)

    by scrytch ( 9198 ) <chuck@myrealbox.com> on Wednesday June 05, 2002 @09:52AM (#3644889)
    Just get the damn thing written, make it flexible enough for us to rewrite perl in perl, and kick this lazy-ass camel out the door before my grandchildren ask me when perl6 is coming out!

    I don't want more powerful regular expressions. I want a more powerful pattern-matching syntax, one I can compile down to an opaque object with a bit of syntactic sugar, then use in place of a regex. I want a parser sub-language like SML or parsing primitives like haskell. Regular expressions are now turing complete thanks to perl ... great, so move on already, regexes are not the final word in pattern matching.

    And what's more -- all this you're doing Larry, it's anti-hacker. It's top-down, it's engineered, it's ivory-tower theory that might sound neat and no matter how zany your presentation is, you are living in the rareified atmosphere of a language designer, and now you are starting to think that way, dispensing wisdom on The Right Way To Do Things from on high. Yes, inventing Just The Right Way to give people 1E+255 ways to do things is still looking for the perfect that's the enemy of the good, because once we have the foundations to improve on perl6, we will do it, but only if we have something to work with. It doesn't all need to be done up front.

    Your extended regexes can be done as a library solution. Stop ending the world and start living in it.

    • I don't want more powerful regular expressions. I want a more powerful pattern-matching syntax, one I can compile down to an opaque object with a bit of syntactic sugar, then use in place of a regex. I want a parser sub-language like SML or parsing primitives like haskell. Regular expressions are now turing complete thanks to perl ... great, so move on already, regexes are not the final word in pattern matching


      Hmmm, I want, I want, I want. Maybe you try changing to: I'll write, and create your own language.

  • by dybdahl ( 80720 )
    If Perl 6 isn't backwards compatible, they do the same Microsoft does with Visual Basic .net: make programmers switch to other tools.

    A good language can introduce new features without changing the basics. This is why PHP got so popular so fast.
    • If anything, this will further advance the acceptance of Perl.

      The biggest problems with Perl are its uglified, glued-on OO capabilities and its general legibility.

      You can do some decent OO with it, yes, but you'll do some language hacking to get there. You can also write some nicely legible Perl code (I try to), but most people don't bother.

      Perl5 is going to be around for a long time... a whole lot of code has been written in it, and much of that code is critical due to Perl's usefulness as a glue language and for web programming. So a lot of people are locked into Perl5, at least, for maintaining existing code.

      But Perl6 is going to address some of the major problems with Perl5; I expect its adoption rate to be high.

    • A good language can introduce new features without changing the basics. This is why PHP got so popular so fast.

      Does PHP have inheritance yet? Or let's start simpler: has it stopped dumping every new function into a global namespace? This bugs me in elisp, and it bugs me in php. Actually, it's the fact that PHP passes objects by value (and that they removed the declaration syntax for byref and saddled you with the ugly syntax at call time) that caused me to stop using PHP.

      That and PHP perpetuates the perlism nonsense of:

      $foo->bar(baz,mumble);

      As opposed to a much more sensible:

      foo.bar(baz, mumble)

      Or, when you think long and hard about about it, by using the logical start of the line as a statement beginner, the end of the line as a terminator, and that most args don't have whitespace in them or have other good logical delimiters if they do:

      foo bar baz mumble

      Only Tcl does anything like this, though lisp comes close (but I shouldn't need the top level of parens if I have other delimiters). It's just a shame that Tcl's runtime is so brain damaged, and that it's become irrelevant as a language these days.

  • perl 7 (Score:2, Funny)

    by poincare ( 63294 )
    I quote apocalypse 1 [perl.org]:

    So Perl 7 will be the last major revision. In fact, Perl 7 will be so perfect, it will need no revision at all. Perl 6 is merely the prototype for Perl 7. :-)

  • I heard of it back in 2000, and nothing cince.. one of the core developers was working on a mini-perl for embedded systems and I have bee neagerly waitong for it but ..... nothing.. no small perl that takes up very little space...

    Anyone have any clue as to it's progress?
  • I can't get to the apocalypses, or anything on perl.com, from two different sites. Is there a mirror anywhere? Is nothing sacred?

    Ahem. *cough* There's nothing useful in this Apocalypse. Go read something else, so I can read it.

Talent does what it can. Genius does what it must. You do what you get paid to do.

Working...