Slashdot Log In
Perl's Extreme Makeover
Posted by
CmdrTaco
on Thu Feb 19, 2004 05:40 PM
from the we-likes-it-don't-we-precious dept.
from the we-likes-it-don't-we-precious dept.
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.""
This discussion has been archived.
No new comments can be posted.
Perl's Extreme Makeover
|
Log In/Create an Account
| Top
| 408 comments
(Spill at 50!) | Index Only
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Whew, backasswards compat-with Perl 5 (Score:5, Funny)
Nice!
-mb
Re:Whew, backasswards compat-with Perl 5 (Score:5, Informative)
(http://clickcaster.com/)
Consequently, Perl 5 code should run faster under Perl 6.
Perl: The Beginning (Score:5, Funny)
a 0 an explosion
a
a | factory!!!!
a
Re:Perl: The Beginning (Score:5, Interesting)
s/(.*?\s+)\(.*?\)/$1/g
Looks like an explosion in the ascii factory to me!
Re:Perl: The Beginning (Score:5, Insightful)
(http://www.hogue.org/)
This is trying to match something like adsfdfsdfs()ASDfasd#@$!@afd (adsfad@#$@!)
and replace it with
asdfa asdfa asdf adsfdfsdfs()ASDfasd#@$!@afd
or basically, get rid of things in parenthises that are after at least one white space.
so,
s/\s+\(.*?\)//g would work...
but still a lot of slashes
so try this
my $stuffInParen = qr| \(.*?\) |;
s/\s+ $stuffInParen
or even
my $stuffInParen = qr| \(.*?\) |;
my $whiteSpace = qr| \s+ |;
s/$whiteSpace $stuffInParen//gx;
now, you can look at the code and have a pretty good idea what it's doing. (even without comments). we're switching stuffInParens that follow whitespace with nothing. just because Perl gives you the flexability to write ugly code doesn't mean you should. if you are writing perl code and it looks ugly, you're doing it wrong. you should find another way to do it... with great power comes great responsability.
see http://www.perl.com/lpt/a/2003/06/06/regexps.html [perl.com] for more info.
or you could just use the x modifier (Score:5, Informative)
(http://cliveholloway.net/ | Last Journal: Saturday February 28 2004, @05:54PM)
lameness filter won't let me space the comments neatly, but I'm sure you get the idea.
.02
cLive ;-)
Re:Perl: The Beginning (Score:5, Funny)
(http://elgoog.rb-hosting.de/)
With the greatest respect, I think you're missing the point of Perl. If you can understand your code, the Indian programmer who replaces you can understand it.
Perl Haikus (Score:5, Funny)
Re:Trolling, maybe (Score:5, Insightful)
(Last Journal: Saturday September 20 2003, @01:55PM)
Re:Trolling, maybe (Score:5, Informative)
(http://www.cityofhope.org/microseq)
You might be interested in Ponie, then. Ponie is the project to create a Perl5 interpreter for Parrot. It should let you get much of the speed benefit of the new virtual machine without having to learn the new Perl6 syntax. Of course you may still want to learn the new syntax, since it will add many powerful new features, but Ponie will ensure that Perl5- and all of the work you've put into your Perl5 scripts- won't be completely abandoned just because Perl6 has come out.
We're all going to die (Score:5, Interesting)
(Last Journal: Friday February 20 2004, @04:11PM)
Back to Pac Man and Vi then...
Hmmm (Score:5, Interesting)
(Last Journal: Saturday January 10 2004, @08:01AM)
Re:Hmmm (Score:5, Funny)
quick question.... (Score:5, Funny)
Re:quick question.... (Score:5, Funny)
Expressions .. (Score:4, Insightful)
(http://www.livejournal.com/users/sinistertim101 | Last Journal: Saturday March 24 2007, @12:32PM)
I suppose it has to do with the old debate of losely or strict typed langauges. 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.
Yahoo decided to support php rather then perl in their next generation yahoo services specificially because of "There is more then one way to do it".
Of course its all being outsourced to India now where they can just hire more developers if complex problems arrise
Re:Expressions .. (Score:5, Insightful)
(http://tru7h.org)
Yes but you have to admit that perl has a certain charm about it.
Haven't you ever sat there staring at a subroutine, thinking to yourself "man I sure wish I could just hold shift and slide my finger over the number row to get this done"? Then gone on and painstakingly crafted what you wanted to do in whatever strict language you were actually working in?
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.
Re:Expressions .. (Score:4, Insightful)
Whereas I look at my Perl code for about an hour and a half thinking, "Ummmmmmm, what the fuck is this supposed to mean?
Not that either of them have a patch on APL, mind you. APL Roolz.
KFG
Re:Expressions .. (Score:5, Insightful)
(http://www.nodomain.org/)
If you haven't got the time to write something properly, forget it - you'll only regret it if you write junk.
Ever heard of comments? (Score:5, Interesting)
(http://cliveholloway.net/ | Last Journal: Saturday February 28 2004, @05:54PM)
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 [catseye.mb.ca], I suppose.
tch
cLive ;-)
right...but (Score:5, Insightful)
(http://cliveholloway.net/ | Last Journal: Saturday February 28 2004, @05:54PM)
I'm not sure how "Healthy, readable code with sensible naming conventions and a clear structure" explains to you at a later date why you coded as you did. If you had to write something that looks out of place to deal with some legacy code you inherited, I'm sure you'd psychically pick that up just by glancing at the code. Or perhaps you go round naming vars something like $quirky_flag_to_pick_up_strange_situation_caused_b y_bad_code_in_package_X?
And what if someone less experienced than yourself has to maintain your code at a later date? Something that may seem obvious to you may be off of their radar.
If you never have to ask why and no one less intelligent than you ever looks at your code you either are very very lucky, very stupid or unemployed.
.02
cLive ;-)
Re:Ever heard of comments? (Score:5, Insightful)
(http://localhost/ | Last Journal: Tuesday January 16 2007, @02:40PM)
He can tell you some really interesting stories about times you can't remember, but he slows you down immensely so he usually gets left at the old folks home while you try to get where ever you're trying to go.
Re:Expressions .. (Score:5, Insightful)
Pretty ironic when you consider that PHP has exactly the same issue, along with some other issues Perl does not have (lack of namespaces, inadequate comparison operators, etc.).
Re:The Parrot Vaporware Engine? (Score:4, Informative)
(http://www.jwcs.net/~jonathan/)
http://www.jwcs.net/developers/perl/po
The 0.1 release may be coming by the end of this month - and if this release isn't 0.1, I'm pretty sure the next one will be. That means Parrot has objects, some of the threading stuff is in place, JIT is working on various platforms and more. There's a lot of hard work going in by a lot of very good developers (not me!), and I'm confident that Parrot will be completed and will be a hot target for dynamic languages.
Re:No, Python (Score:5, Funny)
I am the lead developer on a 200K line commercial bioinformatics program written in Perl. That's job security.
Re:No, Python (Score:4, Funny)
(http://douglas.min.net/essay/)
Re:Ruby... (Score:5, Insightful)
Sorry, but you had missed some things that Ruby has none of compared to Perl.
Re:Ruby... (Score:5, Informative)
(http://www.cg2.org/)
Doc
http://www.ruby-doc.org/ [ruby-doc.org]
http://www.rubycentral.com/book/ [rubycentral.com]
Unit Testing
http://testunit.talbott.ws/ [talbott.ws]
http://www.rubygarden.org/ruby?RubyUnit [rubygarden.org]
Library Repository
http://raa.ruby-lang.org/ [ruby-lang.org]
Portability
Source compiles on anything vaugely Unix like
Windows binaries available
User Community
comp.lang.ruby [lang.ruby]
So, what were you on about again?
Re:Perl... (Score:5, Informative)
Doc
Something a little more thorough.
http://www.perldoc.com/ [perldoc.com]
Unit Testing
Not just wrappers, but something a little more thorough and mature like say from executable to module.
Unit Testing [newportal.com]
Library Repository
http://raa.ruby-lang.org/ [ruby-lang.org]
http://www.cpan.org/ [cpan.org]
Portability
[Acorn] [AIX] [Amiga] [Apple] [Atari] [AtheOS] [BeOS] [BSD] [BSD/OS] [Coherent] [Compaq] [Concurrent] [Cygwin] [DG/UX] [Digital] [DEC OSF/1] [Digital UNIX] [DYNIX/ptx] [EMC] [Embedix] [EPOC] [FreeBSD] [Fujitsu-Siemens] [Guardian] [HP] [HP-UX] [IBM] [IRIX] [Japanese] [JPerl] [Linux] [LynxOS] [Macintosh] [Mac OS] [Mac OS X] [MachTen] [Minix] [MinGW] [MiNT] [MPE/iX] [MS-DOS] [MVS] [NetBSD] [NetWare] [NEWS-OS] [NextStep] [Novell] [NonStop] [NonStop-UX] [OpenBSD] [ODT] [OpenVMS] [Open UNIX] [OS/2] [OS/390] [OS/400] [OSF/1] [OSR] [Plan 9] [Pocket PC] [PowerMAX] [Psion] [QNX] [Reliant UNIX] [RISCOS] [SCO] [Sequent] [SGI] [Sharp] [Siemens] [SINIX] [Solaris] [SONY] [Sun] [Symbian] [Stratus] [Tandem] [Tru64] [Ultrix] [UNIX] [U/WIN] [Unixware] [VMS] [VOS] [Win32] [WinCE] [Windows 3.1] [Windows 95/98/Me/NT/2000/XP] [z/OS]
User Community
A little more world wide and established.
http://www.pm.org/ [pm.org]
So, what were you on about again?
From the parent parent parent poster. "Ruby has almost all of the power of Perl, with none of the ugliness" isn't quite a fair statement, considering Ruby is lacking or behind on almost everything else Perl is superior at. Ruby is still playing catch up, and depending on who you ask, can also be considered ugly.
What everyone knows about perl (Score:5, Funny)
(http://www.angelfire.com/cantina/cow0/ | Last Journal: Tuesday January 27 2004, @07:08PM)
Unreadable code,
Why would anyone use it?
Learn a better way.
ugliness that grows
into beauty inside of
your favorite shell
Arbitrarily
Nested structures for data;
Joy of birds in flight.
As with the spring rain
Perl is indispensable
Unquestionable
http://aspn.activestate.com/ASPN/Perl/Haiku/Abo
Anyone who intimately knows 5 (Score:5, Interesting)
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.
Re:Anyone who intimately knows 5 (Score:5, Interesting)
(http://hammeroftruth.com/)
Re:Anyone who intimately knows 5 (Score:5, Informative)
(Last Journal: Saturday June 05 2004, @07:06AM)
I cannot claim to intimately know Perl 5, but I started learning it a few years back. I belong to the camp of Perl programmers (and I know there are a few of these) who are adopting a "wait and see" attitude to Perl 6.
If you're interested in learning Perl now, you should probably go for the cookbook approach, ie: get a copy of OReilly's Perl cookbook and just try applying the solution to your problem. Then, trying tweaking and figuring out how it works.
As for learning Perl 5, I'd probably point out that there are still some places that run 5.005_03 (certainly Solaris used to ship with that version by default), and that version is at LEAST 5-6 years old :) There are even some places I've heard of that run Perl 4 :) So, I think there is plenty of time to have your investment in learning Perl pay off before people start switching to Perl 6 en masse.
Re:Anyone who intimately knows 5 (Score:5, Informative)
Re:Anyone who intimately knows 5 (Score:5, Insightful)
(http://www.highprogrammer.com/alan/ | Last Journal: Saturday April 29 2006, @04:33PM)
Learn Perl right now because it will make your life better (assuming your life can be made better by a powerful scripting language/glue-layer from heck). Perl 6 is still far off on the horizon and Perl 5 knowledge will largely transfer to Perl 6.
I think that setting out to learn Perl for its own sake will generally not work. One of Perl's strengths is that it grows with you and your needs. Learn a little bit of Perl and you still solve some very useful problems. For example, many people first learned Perl to do some quick-and-dirty projects like one-off data file reformatting, internal report generation, or simple CGI scripting. Learn more as you need it. It's taken me years to get to the point where I might call myself a skilled Perl hacker. But every step along the way was pleasant. I never felt I was learning stuff for the sake of learning stuff; I was always learning something that made my goals right now easier to achieve.
Perl is about serving you, not you serving it.
Re:Anyone who intimately knows 5 (Score:4, Informative)
(http://cliveholloway.net/ | Last Journal: Saturday February 28 2004, @05:54PM)
Start now. It's gonna be a while before six is out - and even longer before companies will trust it in production environments.
And come over to The Monastery to get help when needed. A great resource for new (and experienced!) Perl hackers. [perlmonks.org]
.02
cLive ;-)
Re:Anyone who intimately knows 5 (Score:5, Insightful)
So, I won't claim to know any language intimately.
But... I have programed in Perl for the last five years. Why is simple.
Because Perl let's me leverage the last 20 years of programming. If they see a good idea in another language... they put it in Perl.
You will see a lot of people complain because of how Perl code looks. The simple fact is that you can write clean looking code... or ugly code. Perl doesn't care. It is your code... do it the way you want.
Perl's strength is that it let's a programmer program the way they want to. That is also it's weakness.
My advice would be to spend a few more years with a few other languages. You won't appreciate Perl until you know how elegantly it lets you solve some problems that you have used other tools for.
If you are looking for "structure" and don't have the discipline to enforce it yourself... then stay away from Perl.
Re:Anyone who intimately knows 5 (Score:5, Insightful)
(http://web.abnormal.com/)
Perl started life as shell script with a built in sed and awk. It has since grown.
The regex stuff in perl 5 is just like sed and grep as far as new user is concerned. The simple regex stuff won't change with perl 6 and the concepts are the same. Perl 6 is going to change the shortcut symbols for the regex expressions.
Perl5 have has a =~ operator that is going to get replaced with a ~~ operator. The ~~ will work in many places where the perl5 =~ won't work. This is part of the push to make perl more orthogonal.
Perl6 will also deal with unicode out of the box with no real issues. Perl5's unicode was a bit of a hackjob as the coders learned along the way. Not that unicode is understood, it will be done right. Some of perl6 seems to be intended to get rid of bad practices based on the concept that "all the world is ascii". For example in Perl upto 6 you can say [a-zA-Z] to mean letters but that won't pickup up the latin-8 char set. Perl6is going to make it harder to say that and easy to say "Letters in the current language".
The list processing may get to the point that it is on the same level as lisp.
Perl6 appears to about about 18 months away so if your going to wait, its a long wait.
Damian Conway gave a great talk on this just a few days ago. If you get a chance to hear him talk, take it.
Who would have thought! (Score:5, Funny)
(http://nojailforpot.com/)
Re:Who would have thought! (Score:5, Insightful)
(http://naikrovek.org/)
Perl, if written right, can be a VERY good looking, and VERY easy to understand. All of you that say that it is hard to read are:
a) reading code that wasn't meant to be cute, but was meant to work where nothing else was as practical,
b) reading code that was written by someone that didn't know perl, or are
c) reading code written by someone that knows perl a LOT better than you.
In my personal experience, people that gripe about Perl are the ones that use it least. The people I know that use Perl quickly learned to love it.
Slashdotted. Here's the text (Score:5, Funny)
$_
Re:Slashdotted. Here's the text (Score:4, Funny)
(http://douglas.min.net/essay/)
Re:Slashdotted. Here's the text (Score:5, Funny)
Why was Perl5 so Popular? (Score:5, Interesting)
(Last Journal: Thursday February 26 2004, @12:47AM)
Re:Why was Perl5 so Popular? (Score:5, Insightful)
Perl exposes the mind of the programmer more directly than any other programming language.
If you are more interested in quick hacks and dirty tricks than writing clean and manageable code, your perl will reflect that. If you are interested in impressing people by compressing seventeen operations into a single line of code, your perl will be an ugly, ugly thing.
However, if your intention is to write clear, maintainable, understandable code, then this is what you will write. It isn't hard -- in fact I believe that Perl's flexibility makes this a much easier task than just about any other language. Here are a few of my favourite rules for Perl programmers:
1) Just because you can, doesn't mean you should.
2) One line of code means one operation or idea. MAAAAYBE 2. See point #1.
3) If there is a cute, short, hackerish way to do something, and a longer, more boring, more explicit way to do the same thing, ALWAYS pick the boring way. Anyone who looks at your code in six months will be very pleased (instead of ready to kill you). Since Perl is so flexible, this is always possible. 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.
Too many cooks (Score:4, Interesting)
(http://goat.cx/ | Last Journal: Wednesday August 18 2004, @02:34PM)
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.
From the horse's mouth (Score:5, Informative)
(http://www.highprogrammer.com/alan/ | Last Journal: Saturday April 29 2006, @04:33PM)
If you want the real scoop on the on-going planning of Perl 6, you might want to check out Larry Wall's Apocalypse articles: 1 [perl.com], 2 [perl.com], 3 [perl.com], 4 [perl.com], 5 [perl.com], 6 [perl.com]. On the down side, they are dense. Very dense. For that reason, I actually recommend Daimon Conway's Exegesis articles: 2 [perl.com], 3 [perl.com], 4 [perl.com],