Perl's Extreme Makeover
PurdueGraphicsMan writes "There's an article over at Yahoo! about the upcoming version of Perl (version 6) and some of the new features (RFC list). From the article: "Although Perl 5's expressions are the most sophisticated available and aspired to by other programming languages, "no one pretends for a moment that they're anything but hideously ugly," said Damian Conway, a core Perl developer and associate professor at Monash University in Australia.""
We might be able to actually use them in ten years or so... I do appreciate Open Source speed (done when done) and Perl is pretty complex but maybe they should have broken the upgrades into parts?
Is there anything better than clicking through Microsoft ads on Slashdot?
Back to Pac Man and Vi then...
"If you think nobody cares if you're alive, try missing a couple of car payments." Earl Wilson
...provides almost all of Perls power, with none of the ugliness.
TODO: Something witty here...
...would be able to tell me if i should
a) start learning 5 anyways
or
b) wait till 6 is released, because going from barely having a grasp on 5 and then trying to learn 6 would just confuse myself?
i realise that all the perl5 code in the world won't suddenly cease function the minute perl6 is released, but still..
I can see the value in perl, and what a great tool it is, but for some reason i have a hard time wrapping my lil brain around it. It's a bit less "structured" or "consistent" than say C is. I suppose it has to be that way in order to do what it does, though.
do() || do_not();
Perl 6 is *insane* .. the kind of thing that is either the work of a genius or
.. I'm sick of "(?:..)" and other confusing add-ons.. and 2)
a madman. Or both.
I used to really like Perl, but these days I'm writing bigger and bigger
programs using interpreted languages. Perl is *really* getting on my nerves.
I'm not waiting for Perl 6, I'm writing all new code in Ruby (or Python if
Ruby doesn't have the needed 3rd-party libraries).
Ruby is what Perl *should've* been, and what Python will be in a couple more
versions (it got popular before they finished designing it, it seems).
I'm sure Perl 6 will be like getting a blow job from Larry Wall himself, but
I've had enough of Perl's community and their "cleverness". I want languages
that help me write programs, not that are good for writing haiku in.
However there are two things I"m looking forward to: 1) better regular
expression syntax
a common runtime between perl, python, and ruby, that way I can use all sorts
of libraries in my code, no matter what the language I happen to be using.
With such bloated and obscure syntax in both the language and regular expressions, why do you think Perl 5 has become so popular? Once you've written a few programs in it, it is ULTRA EASY, ULTRA FAST and not hard to remember. An experienced Perl programmer could probablyl do almost any text processing task in a third of what it would take an expert C++ programmer to do. All of the bloat and lack of orthogonality and "bad design" paradoxically makes Perl 5 a fantastic language to program. I hope Wall doesn't mess this up...
While no one would ever accuse Perl of being single minded and focused, until Perl5 it was a fairly coherent language.
I understand that Perl6 is supposedly an evolution of the language, but there are so many suggestions for so many features and changes that the language itself seems to suffer from the too many cooks problem. With everyone and their brother suggesting features, the language itself becomes a mish mash of these features without a central theme tying it all together. Even if you said that DWIM was the central theme, can you really justify that when WIM is not what the language does because the feature that I'm using was designed by someone who had a completely different idea of what he meant?
In the past Perl has added functionality that was useful and you can see where the language has its partitions. Base Perl (datatypes, simple arithmetic, simple string manipulation), nested datastructures, regexes, OO, and so on. While admittedly a mess, each addition to the language brought more power and ease. Perl6, OTOH, seems to be adding feature after feature without regard to whether it makes the language easier to use, only more powerful.
So you end up with a new interpreter that won't run your old scripts without modifying the scripts. At the very least it should automatically default to Perl5 syntax unless otherwise told to use Perl6 syntax. Unfortunately, in the push to evolve, Larry and Damian (and the rest of the lunatics) have foregone automatic backwards compatibility.
I'll probably migrate, but not for a while.
I have been pwned because my
IIRC it's possible to write OpenOffice macros in Perl (Though it probably takes some nasty hacked API to do it). And of course, given how easy it is to embed a Perl interpretter into C apps (possibly moreso with Parrot) then there's really no reason why it can't be used for game scripts.
user...
.NET runtime engine? If so is the plan for it to be as robust as the JVM / .NET runtime: i.e. could the same type of applications that people are building for Java / .NET be just as easily built with Parrot?
.NET to become without the "what are those bastards going to do to the platform" stench.
Is Parrot something akin to the JVM /
If I'm reading all of this right Parrot may well become everything Sun wants Java to become / MS wants
Of course, if I have the wrong end of the stick here I apologise. Perl isn't my strong suit.
I'm amused to see that the name 'Parrot', originally coined for an April Fool's joke over at O'Reilly, has now been used to christen the bytecode interpreter for Perl 6. Life imitating art I guess.
As for the 'extreme makeover' ... I hope it loses a bit of the excessive punctuation ...
[ UNSIGNED NOT NULL ]
Because it's a high-level language with lots of sytactic sugar that made a whole new level of flexibility in programming. You can be loose, sloppy, tight, properly formatted, or write one-liners with equal ease.
I agree with the main topic that other languages aspired to its expressiveness. The problem, from the point of view of a Perl hacker like me, is that some of them have actually outdone it, primarily by creating similar power, expressiveness, and simplicity but without being so ugly *and* being OO. Ruby and Python are pretty much the motivators for the upgrade.
these regular expressions were not "powerful enough for many data-parsing tasks
I will be the first to applaud Larry Wall and the Perl developers if they can clean up regex. However, I feel tinkering with a notoriously complex thing may make it worse. Or at best, may make more of an ugly thing. What we don't need is the new unreadable way and the old unreadable way of creating regexes. What fun it will be to debug code.
Frankly, how can you increase the power of regex and minimize the complexity of code. If you make regexes more powerful, you might as well make another high-level language for text processing. Let's hope they can pull it off.
Frankly, I for one like the power of Perl's regexes and I hope they succeed.
What do you mean my sig is repetitive? What do you mean my sig is repetitive? What do you mean....
I used to use python a lot. Still do, really. I like it a lot.
I just like ruby more. I find it easier to learn, even faster to code in, and language development is just as fast, if not faster than python.
TODO: Something witty here...
Heh. Still, it's worth noting that this isn't new to Perl 6. Perl's always been a Chimera. Quoth the Perl man page (as it has as long as I can remember), "Perl combines (in the author's opinion, anyway) some of the best features of C, sed, awk, and sh, so people famil- iar with those languages should have little difficulty with it. (Language historians will also note some ves- tiges of csh, Pascal, and even BASIC-PLUS.)" As for why being a freakish blend and a giant mess is actually a feature, I suggest checking out Larry Wall's Second State of the Onion. (It's a long page, but the stuff on the advantages of complexity is all near the top.)
Search 2010 Gen Con events
Spitbol could do things like:
- stringtomatch "this is some text" skipto("(") $ pre_paren ( funcof(pre_paren)$parenmatch = replacement(parenpatch) )
In this case, the $ is an immediate assignment of the match from skipto("(") (roughly equivalent tofuncof is then called with the newly assigned variable (pre_paren), and it's result is inserted as an expression to complete the match.
then whatever matched funcof(pre_paren) is replaced by the results of replacement(parenmatch)
skipto is a builtin, but funcof and replacement would have to be user-defined (and they can be defined on the fly).
Perl6 appears to have similar functionality, but (IMHO) I don't think it's going to be quite as nice as the SNOBOL syntax.
Unfortunately, I'm not good enough at compiler design to write my own spitbol interpreter, or I would.
The one problem with snobol is that it was created before the idea of structured programming came along, so it is goto-structured... (although somebody then came up with ratbol which was essentially a preprocessor to provide RATional structure to snoBOL)
Free Software: Like love, it grows best when given away.
>> Python enforces clarity
,
> So does a man standing next to, you holding a gun to your head, saying "INDENT THOSE BLOCKS!".
Certainly, but somehow Python doesn't make me feel quite as nervous.
Besides, there are too many availeability and cost issues with men-standing-next-to-you-holding-gun-to-your-head
whereas Python is 100% free, which I've found to be much more convenient.
The unofficial
If you're looking at code *you wrote* for over an hour without understanding it, you only have yourself to blame. Unless you're coding in brainfuck, I suppose.
tch
cLive ;-)
-- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
man awk
well, this is quite proper and normal syntax:
s/(.*?\s+)\(.*?\)/$1/g
Looks like an explosion in the ascii factory to me!
--
This sig is inoffensive.
As for performance, well, in my experience the slick, hackerish ways of doing things often slow things down more than the explicit-using-more-lines way of doing things.
Amen. I think this is because the interpreter / VM is usually optimised for the most obvious way of doing things. If you try and improve the performance of your code with tricks and shortcuts, you're basically trying to outsmart the Larry and the other internals hackers.
Vino, gyno, and techno -Bruce Sterling
Perl is highly modular but I would hate to work in a team of 10 or more perl developers all writing in their own styles and methods. Shudder.
Its called DISCIPLINE and its not that hard. Someone makes rules for the dev team and then they are followed and then your code is clean and readable. Why should the language force you to be disciplined? Good programmers know to program following some kind of standard.
And why does everyone bring up PHP? PHP is nothing but Perl with all the best parts taken out and everything thrown into the core language. PHP breaks all the rules of good disciplined programming. With Perl you can shoot yourself in the foot but at least the newbies stay away from it enough to keep the damage to a minimum, and it has controls such as 'strict' and Taint mode so you know when you are shooting yourself in the foot. PHP on the other hand gives the newbies a shot-gun and says 'point this at your head'. PHP coders that actually understand the basics of good programming are few and far between. And trust me there is more than one way to do things in PHP as I've been fixing the problems created by the former 'programmer' in my company for the last year.
The Anti-Blog
Here's an idea: get over it. It isn't that big of deal, and either choice is vastly more readable than perl.
Let the flames begin!
There is much pleasure to be gained in useless knowledge.
I must be sick in the head or something, but I fell in love with Perl reading the 'Learning Perl v4' llama on the tube in 96 - to me the elegance simplicity and yes beauty of the code really took my breath away. Good Perl code is one of the few things that aren't music that genuinely move me, tickle my aesthetic dangleberries as it were.... I mean... while (){ print; }... *sigh* no really. I'm serious. Granted I was programming in Visual Basic when I fell for Perl - frmo the ridiculous to the sublime really....
There are a lot of reasons but the short answers are regexes and the fact that non-programmers can get started quickly. Plenty of sharp minds think "If I could only sort throw this text and do this...." Perl lets them do that. You'd be amazed at the biology you can uncover with 50 lines of code and 50 megs of sequence. (If they don't 'use strict' though, plenty of comical things can happen.)
I've seen plenty of poor Perl code, but I wouldn't call any of it unreadable--just bad. Writing truly unreadable code in Perl requires a much higher level of mastery than most people ever acquire.
I didn't even know it existed. What books/resources should I read if I'm going to stick with perl 5?
But how does eval $string work in a runtime with no compiler?
"that's not encryption - it's a new perl script that I'm working on..." - from some Matrix parody
Almost every language has text processing capabilities. Here's a dirty little secret most people don't know . . . regular expressions for bioinformatics work is not as important as people would like you to believe. The fact of the matter is, most of the data bioinformatics researchers encounter is structured data. Simple string parsing and tokenization is all that is needed. Regulars expressions past the most simple are rarely encountered. In fact, a lot of the data a bioinformaticist encounters is in either XML, tab-delimited, or CSV. For the text processing part of my tasks, I have often used awk to blow my way right through a text file. Of course perl can do the same thing, but I'd like to point out that awk is great when so much of your data is in tabular format (we've got databases everywhere in this field). I also find Java's String, StringTokenizer, BufferedReader and Writer mixed with the FileReader and Writer classes to work great with text files too.
This brings me to my last point. Perl is horrible for some areas of bioinformatics. A lot of people employed in so-called bioinformatics positions spend like 90% of their day parsing through text files. Most people don't know that there are bioinformaticists who spend very little of their day doing that, but instead are developing algorithms and such that usually require a different language. For instance, I'd hate to run a Hidden Markov modeler with the Viterbi algorithm coded in Perl :) Or how about a massive simulation during haplotype reconstructions in perl? Or maybe a support vector machine in perl? Hee, you get the idea. For these tasks C is often chosen. Particularly if one employs parallel programming. I encourage bioinformaticists to explore other languages besides perl so that they have a vast array of expression for the multi-facted charges a computational biologist is expected to handle.
Maybe it's just me. But every time I sit down and promise myself to write a new script all tidy and clean in python, about five minutes into it I'm muttering "if this were perl I coulda been DONE by now" and quickly revert back to old faithful.
Funny. I feel the same way about PHP. It's routine for me to take some broken, busted stuff written in Perl or c or whatever, and redo it in PHP in 1/4 the lines.
As Jethro Tull once said:
"You know what you like, and you like what you know".
I can "do" Perl, but it brings me much grief to do so. While I find PHP consistently readable and understandable, pretty much no matter who wrote it.
Oh, and BTW, since I've taken the time to "get" regex, I don't even find it ugly. The earlier example about $stuffinParen or whatever was hideous, and not nearly as understandable to me as the simple, concise, original example. Einstein once said:
"Everything should be made as simple as possible -- but no simpler!".
I have no problem with your religion until you decide it's reason to deprive others of the truth.
They should be replaced by something better, such as Xerox' Extended Regular Relation Calculus: Here are some examples.
The nice thing about it is that it's fully declarative and bi-directional, i.e. a:b can be applied substituting a by b or vice versa (if run backwards), whereas the traditional
pattern-action paradigm that Perl has inherited from awk is only partially declarative (only the pattern).Another interesting property is that xfst, one of Xerox' compilers, allows naming and re-use of subexpressions:
(all without any ugly '$'sAbstraction by naming is a powerful feature, as Abelson and Sussman (SICP) and other good elementary textbooks point out.
Maybe anybody wants to volunteed to build something like this into Perl6 instead?