Slashdot Log In
Perl 5.10, 20 Year Anniversary
Posted by
CmdrTaco
on Wed Dec 19, 2007 08:52 AM
from the thats-a-lotta-candles dept.
from the thats-a-lotta-candles dept.
alfcateat writes "Perl 1 was released to the public by Larry Wall 20 years ago yesterday. To celebrate, Perl5Porters have released Perl5.10, the latest stable version of Perl 5. Happy Birthday Perl!
Perl 5.10 isn't just a bug fix version: it's full of new features that I'm eager to use: named captures in regular expressions, state variables for subroutines, the defined-or operator, a switch statement (called given-when, though), a faster regex engine, and more. You can read more about the changes in perldelta."
Related Stories
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
Hmmmmmm (Score:5, Insightful)
I was right... we hit double-digits with Perl 5 before Perl 6 became available... and don't go on about Parrot -- it's not Perl 6. I'll be interested to download 5.10 and see what it can do. The speedier regex engine is going to be a great boon.
Re:Hmmmmmm (Score:5, Insightful)
Parent
Re:Hmmmmmm (Score:5, Funny)
You *know* what kind of responses you are asking for when you write something like that don't you....
Parent
Re: (Score:3, Informative)
Re: (Score:3, Insightful)
Re:Hmmmmmm (Score:5, Funny)
Parent
Re: (Score:3, Funny)
Re:Hmmmmmm (Score:5, Funny)
Parent
Re:Hmmmmmm (Score:5, Interesting)
If Parrot becomes "efficient enough", then hosting Perl, Python and Ruby on Parrot should permit writing programs in a mixture of all three. Python has a very extensive library, but I certainly wouldn't mind having all of CPAN for which to choose as well - or access to Rails, for that matter. (Yes, I know, much of Rails' value is in its elegant fit to Ruby syntax, but I'd still like access from Python. Call me a library pack rat. :-)
For another example of recent interest to me, Perl and Ruby have excellent integrations with GraphicsMagick; Python has Python Image Library (PIL) instead. Why can't I choose the graphics library I want from any of the big three dynamic languages?
Nor would Parrot implementations of those languages need to replace the main implementations to be useful. The JVM has Jython and JRuby, granting access to Java libraries like Swing. Similarly, Microsoft's .NET has IronPython and IronRuby to avoid the much-maligned VB6. Interoperable implementations of Perl 6, Python 3, and Ruby 2 on Parrot would be very nice indeed.
Well, for a dynamic language junkie like me, at least. ;-)
Parent
Switch statements are syntactic sugar (Score:3, Insightful)
Re: (Score:3, Funny)
Yeah, and who needs if statements anyway, or a high-level language come to that? Just syntactic sugar, I say we go back to sector-editing ones and zeros directly to the disk. Readability? Pah.
Cheers,
Ian
Re: (Score:3, Funny)
Re: (Score:3, Funny)
Lean on your keyboard for long enough, and you will eventually have produced a valid Perl script. Of course you won't know what it actually does, but then how does that differ from 90% of Perl scripts anyway?
Cheers,
Ian
Re:Switch statements are syntactic sugar (Score:5, Insightful)
Parent
Re:Switch statements are syntactic sugar (Score:5, Funny)
2 + 3 == 5 (Perl isn't that weird)
2 + "3" == 5 (not a TypeError as in Python)
"2" + 3 == 5 (not "23" as in JavaScript)
"2" + "3" == 5 (not "23" as in both JavaScript and Python)
Parent
Implicit vs. explicit parsing (Score:4, Insightful)
Implicit parsing a num to a string is straightforward and will pretty much always work, even if you may get wierd results like "1.66666666666666666667". But the other way is just too careless to let be implicitly done. You may unexpected errors when for some reason the string you use cannot be parsed, and you may get either an unexpected datatype or a truncated result when a parsed string would not match the other num you add to it (such as int a = x+5 where x is a string "3.5").
Casting from string to number should always be done explicitly, with precise definition of the data type you cast to, and ideally with an error catching block in case something goes wrong. Letting it be done implicitly is a recipe for headache.
Parent
Re: (Score:3, Funny)
Let me guess: You like Pascal. The language that, if it was a car, would have only one pedal and two forward gears.
I program in high-level languages precisely because I don't want to have to think about whether something is a string or a number. I have bought an
Re: (Score:3, Informative)
Are you sure about that?
$ perl -e 'print 2 . "3", "\n"'
returns 23 on my system (perl, v5.8.8 built for x86_64-linux-gnu-thread-multi). Note you need a space before the dot, otherwise Perl gets its knickers in a twist because a dot looks like the fraction delimiter; but that's OK, because we don't have to strip out unnecessary spaces to make our code fit into the remaining 6KB of RAM (after allowing 20K for the framebuffer and 6K reserved for the system) an
Re:Switch statements are syntactic sugar (Score:4, Interesting)
(if (> 3 2) 5 4)
which obviously evaluates to 5. But you know what? You can eliminate the if operator entirely if you let > (and any other predicate) return a two-ary function:
(define true (x y) (x))
(define false (x y) (y))
and stuff the arguments into separate functions for deferred evaluation:
((> 3 2) (lambda () 5) (lambda () 4))
Parent
Re:Switch statements are syntactic sugar (Score:5, Funny)
>You wrote something accidentally insightful. Look at the following expression:...
Away - away foul Lisp advocate, and darken not my doors again!
Cheers,
Ian
Parent
Re: (Score:3, Informative)
Well, most languages have a ternary operator ?:, which allows to get away without if in any situation. In Perl and Python you can do:
Where CASEx is boolean and STUFF_TODOx is some statement. It has to return true in order to halt the search though, so, in general case you have to go for something like
As well as in your LISP example, this is ugly enough to be avoided when
Re: (Score:3, Interesting)
And then I'm carelessly skipping over 3 > 2 ? 5 : 4, which is of course the *correct* solution
Re: (Score:2)
I find if-else statements to be quite sufficient. They might be less efficient when compiled, I'm not sure, but when it comes to the readable code, they're simpler to write and parse most of the time. Conditional jumps of any kind are wasted clock cycle intensive regardless. I suppose I could output the assembly and hand optimise that, I know how to do it (yeah, how sad am I...), but if I wanted to do that I wouldn't be using C in the f
Re: (Score:2)
Re: (Score:2)
Re: (Score:3, Insightful)
Lambda-calculus is in no way high level, it just doesn't happen to correspond to a machine model.
Re: (Score:2)
Re: (Score:2)
Re: (Score:3, Funny)
Re: (Score:2)
I can't wait Perl 6 anyway especially for their promising new Object oriented syntax (and static types).
Re: (Score:2)
Re: (Score:3, Informative)
C/C++ only allows constants to be used as case values in a switch statement, you can't use a variable as a case label. This allows the compiler to optimise the comparisons based on the numerical value of each constant case label. Performing the case evaluations in different orders, using subtraction and addition and testing against zero can be more efficient than comparison
Re: (Score:3, Funny)
Readability? You do realize this is Perl we're talking about?
Aren't these two unrelated events? (Score:2, Insightful)
I can't see why (in purely practical terms) it's worth coordinating a release with an anniversary.
Surely if the code is "ready" (thoroughly tested etc) before the anniversary, it could very easily be useful as a release to developers before the anniversary.
If it isn't ready, it shouldn't be released early just because there's an anniversary.
Re:Aren't these two unrelated events? (Score:5, Funny)
A programming language used for poetry.
A programming language where "bless" is a basic operation.
A programming language which borrows the "understood" syntax from English.
A programming language where all published examples contain variables "Foo" and "Bar".
Of course they are going publish a new release on the twentieth anniversary. I dont think it occurred to anyone in the perl community not to.
Parent
Is this the version (Score:3, Funny)
Re: (Score:2)
Re: (Score:3, Funny)
For the younger among you this was a fiendish COBOL construct which altered the
target of a plain "go to" somewhere else in the program. A wonderful tool
for sadists whith a particular dislike of maintenance programers.
Re: (Score:3, Funny)
This is Perl we're talking about here. It would be "orels"
Re:Is this the version (Score:5, Funny)
Parent
Oh dear. (Score:5, Funny)
*sigh* Nice to see they're still adding to the elegance of the language
I wonder if threading actually works in production yet?
Re:Oh dear. (Score:5, Funny)
Not to mention the new "lol()" built-in, which is like say(), but also removes random letters from the string, and appends 17 exclamation points.
Sometimes I wonder about Larry Wall.
Parent
Re:Oh dear. (Score:5, Funny)
Parent
Re:Oh dear. (Score:5, Funny)
Parent
recursive patterns (Score:5, Funny)
Re: (Score:3, Insightful)
Yeah, I saw recursive patterns and thought, "Crap, now I'm going to have to relearn how to look at regexes so that I see those too." Still, I'm excited about the power (while being daunted by the readability).
Much Thanks to Mr. Wall (Score:5, Insightful)
Re: (Score:3, Insightful)
Re: (Score:3, Informative)
The flexibility isn't just CP
Bold perl hackers, I salute you (Score:4, Funny)