Apocalypse 5 Released
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."
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?
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
---"What did I say that sounded like 'Tell me about your day?'"---
So, when Perl 6.final is released, will the release notes be called "Apocalypse.Now"?
--
If you moderate this, then your children will be next.
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).
/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.
:o) I also wonder what the speed of the interpreter is going to be like compared to perl5. Hopefully faster :o)
A lot of this makes a lot of sense however, especially the default
Brilliant I think. I can't wait for it to come out. I hope they make a perl5->6 translator though
Good job Larry, Damian et al.
Something to make the code that little bit more unmaintainable. That keep those PHP whores on their toes :->
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.
development.lombardi.com
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.
development.lombardi.com
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.
Conformity is the jailer of freedom and enemy of growth. -JFK
...is if Cmdr Taco is going to upgrade slashcode to Perl 6 and what he thinks of all this re-write of Perl.
The simple truth is that interstellar distances will not fit into the human imagination
- Douglas Adams
...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 ;)
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!
I hope somebody's going to write some automatic conversion tools because going back to one even a few days later is a hairy experience indeed.
Guess you haven't seen txt2regex? It doesn't support Perl 6 yet - but it supports about 20 languages at this point so I think you can reasonably expect to see more in the future :-)
Cheers,
Toby Haynes
Anything I post is strictly my own thoughts and doesn't necessarily have anything to do with the opinions of IBM.
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?
Stop the brainwash
this guy has been doing some interesting work 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.
#define F(x) int main(){printf(#x,10,#x);}
F(#define F(x) int main(){printf(#x,10,#x);}%cF(%s))
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.
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!
... great, so move on already, regexes are not the final word in pattern matching.
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
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've finally had it: until slashdot gets article moderation, I am not coming back.
It's not that perl is akward. It's a language that lets you code in a number of different styles. It gives you the freedom to code your own way. This does reduce readability, but it greatly increases speed of coding. If others need to read your code, just set up style guidelines.
I use perl for just about all scripting I do on my system. Just a moment ago, I had to read an html file over http, but there were no line breaks. I just needed to get one piece of information, so I did this:Sure it's unreadable, but it did the job. If I'd been writing CGI, I would've been more verbose since terse perl code can be difficult for even the author to understand by reading it.
perl gives you lots and lots of freedom. This is not a bad thing, but it is dangerous. Other languages force you to work in one way.
Think of a bike. A bike w/ trainig wheels makes it hard to fall over, but your agility is reduced. perl has no training wheels by default. You can write really nasty code that works but is unreadable. Perl is anything but limiting.
If you want more structure to protect you from yourself, try running perl the -w option and put "use strict" in your scripts. If you want pretty built-in identifiers, try "use English"
I've been coding for so long that the restrictions built into many other languages just get in my way most of the time. I like the way perl never gets in my way.
t'nera semordnilap