Perl 6: Apocalypse 6 Released
data64 writes "The latest Apocalypse talks about subroutines. Looks like we finally get type signatures which are way more powerful than the rudimentary prototypes available with Perl5."
← Back to Stories (view on slashdot.org)
The VM is showing 10x speed improvements in preliminary tests. Couple that in with Moore's law and Perl (or any languages that compiles to the Parrot VM) becomes a very attractive language for more types of problems.
Heres the thing though, sure I have no idea what that says, but that's just because somebody decided to be very clever/brief/or both. Half my job is to write Perl scripts and sure there are about a million neato tricks that I could use to make my code really short and impossible to read but I never learned them and have no intention to. If you want, Perl can look more or less exactly like C, or if you want it can look like the above. It's all a matter of what you want out of perl.
When they say theres more than one way to do it, syntax is included in there too.
I am a Perl fanatic. I love Perl. But what is going on with Perl 6? The guys working on the Parrot VM for Perl 6 are doing such an amazing job, but I'm pretty dismayed about the language development on Perl 6 itself.
Perl 6 was meant to be a total rewrite. Nothing was meant to be sacred, cruft could disappear, and we'd be left with a mean language, true to its roots, and working on a hot new VM.
Instead we get stuff like this:
sub *print (*@list)
Talk about confusing! * signifies a glob, but in the above example the first * signifies a sort of 'package wildcard' meaning that the subroutine is global! The second *, however, is a glob, as in Perl 5. WTF? Perl 6 looks almost as inconsistent as PHP already, and it's only in draft!
Each page of this Apocalypse presented me with a new piece of cruft to look horrified about. Slurpy arrays!? Oh my god. Wall even goes on about 'psychological reasons' for syntax! 'Default values' and 'Rules' are things that are easily done with existing code.. it's not even as if they result in particularly crufty code in Perl 5.
I'm still looking forward to Perl 6, but it really does seem as if Parrot is where the true action is. Perl 6 really does look as if it is being designed by committee.
mogorific carpentry experiments
Perl has always had a lot of esoterica. Don't let it bog you down. You can be amazingly productive in perl without ever knowing what a typeglob is.
I think I have been trolled, but I'll reply anyway.
:'s in it.
Once I was bored and wrote one line of C code that iterated over an array, and printed its elements separating then with commas, and printed an "and" instead of a comma for the last element. The code consisted of a for, a printf, and ?
Now, don't try to tell me it was readable. Every language can be used to write horrible code.
Besides, that doesn't even look as Perl. "?$where" makes no syntactical sense, variables have names like $where and that's it, "Str + $label" makes no sense either, unless Str is a constant, and "Int +$skip = 0" makes about as much sense as in C, because supposing it's comparing an addition with 0 it should be using ==.
"The lesson to be learned is not to take the comments on slashdot too literally." --Vinnie Falco, BearShare
When does the book come out? Larry Wall's Perl 5 manual was the most fun I've had reading a computer book. Is he going to top it with the Perl 6 book?
This will make Perl an attractive contender for serious application development; something which it came reasonably close to in late Perl5 but didn't quite get there because while you could do most things in a consensually "proper" way, the roll-your-own methodology just wasn't convincing enough for pointy haired project managers.
The primary difference with Perl6 is that it will have full support for strict(ish) typing and object orientation which makes it suitable for large projects where it's impractical to expect programmer A to know anything about how programmer Z's module is implemented internally and vice versa.
The new feature set (together with Perl's availability on a wide range of platforms and the huge range of freely available interfaces on CPAN) means that Java and .NET will be facing some stiff competition in just about every conceivable application niche.
If the speed improvements are genuine then (assuming that one were in a position to choose) for probably the first time ever we will be in a position where there is hardly any real need to maintain skills in multiple languages as Perl will be at least adequate for the vast majority of implementations. It's not unreasonable to suppose the list of exclusions being limited to CPU bound code in high-performance content servers (eg RDBMS, HTTP) and real-time and embedded apps requiring hand-coded assembler or at least tightly optimised C.
Whether you agree with that or recoil in horror at the thought of your favourite language being marginalised, Perl is clearly not just a "glue" language any more. It's about to become a fully-fledged enterprise application development platform.
I'm sure you've already guessed, but for the record I am very much looking forward to this.
There is one fly in the ointment I guess. Perl, like C, is very free-form in terms of what it lets you do but the flip side of that coin is that such languages also let you write dangerously unstructured and unmaintainable code. They require good training and a degree of self discipline to use well. Self taught programmers who didn't have strict typing and nested scoping enforced on them at the beginning of their coding career almost inevitably tend to grow up writing code that is less secure and harder to read than do those who learned back in their college days to associate variable declaration at the wrong level of scope with lower assignment grades and some stern finger wagging from their tutor.
The new Perl will continue to make the impossible possible and the merely hard very easy, but for the first time it will provide support for a more formal structure where that is considered a good thing.
Remember though that Perl is still very much a grassroots phenomenon. Whether this hits anybody's radar screen out in the real world has to depend on how well and how rapidly it is taken up by the Perl community. i.e. upon the willingness of existing Perl code monkeys to grab the inevitable (presumably three-humped) Camel Book, learn the new features and use them deliberately to adopt a more structured and more scalable coding style.
It's on this point I think that Perl6 will succeed or fail. We will need plenty of real world examples out there so that new users have something from which to learn righteous coding principles, and so that sceptical project managers will see successful implentations from which to draw confidence and inspiration.
One problem with Perl, is that it's very hard to read somebody else's Perl code. Most Perl hackers can write scripts that do amazing things in much less space/time than a traditional compiled language, but their code is indecipherable to even other skilled Perl hackers. If you've ever maintained a large Perl program written by someone other than yourself, you know what I'm talking about.
Adding more features to the language will only make this problem worse. Very few Perl programmers know more than a fraction of Perl's syntax. More syntax means more stuff that your average Perl programmer doesn't understand! This is a huge impediment to writing a large project in Perl.
Languages like C and Java stay alive precisely because they're not very expressive. You can write huge behemoth-sized projects and still have some hope of maintaining them, because there just aren't that many ways to obfuscate the code.
Lots of nice features but such complexity and cleverness that even the people who use it don't like it.
IME, Ada is exceptionally well-liked by the people who know it (note: use != know). I've seen far fewer complaints about it from Ada programmers than I've seen from, e.g., C++ or Perl programmers about those languages.
ADA's a good language, but no one uses it.
Right, just like how no one uses Linux on the desktop.
As far as i can tell, perl 6 is supposed to evoke four main reactions:
- Whoa.. It's Scheme, but I don't have to deal with the pervasive suffix notation and all those parenthesis!
- Whoa.. It's Smalltalk, but less heavy on the Everythings-A-Message pounding and without all those wierd hard brackets!
- Whoa.. It's K, but without the need to completely rethink how i program!
- Whoa.. It's Perl, but the object system isn't an eyesore and the reference system doesn't make your head explode!
Or, alternately:- Whoa.. It's a language with all the neat functional-flow-control bits of ML, but I don't actually have to write in ML!
- Whoa.. it's Objective C, but everything's an object, and no need to muck about with C types and baggage unless i really want to! or Whoa.. It's Java, but everything's an object, and there aren't any rules!
- Whoa.. It's APL, but without the need to completely rethink how i program and buy a new keyboard!
- Whoa.. It's a programming language I can trick into acting exactly like Java/LISP/ML/K/APL/Smalltalk/Ruby/Python/Prolog/C
# /Mercury, and still use the Perl string manipulation tools!
Really.. it steals from everyone. I think it's even kind of the point. Of course, maybe I'm completely confused and wrong and have inserted Perl 6 here; but, well, these were the reactions i hadIrritable, left-wing and possibly humorous bumper stickers and t-shirts
I attribute Ada's glorious failure to a few things, and none of them are the language itself:
- It was developed by the gov't. Nobody likes the gov't.
- The compilers are, like I said, really hard to write. So it took a long time for them to get implemented right, and there sure weren't any free (or even "affordable") ones for a long time.
- And the big one: no standard set of class libraries. No Java-like API, no STL, nothing. If you wanted a linked list you had to write it yourself. The Java API is half the reason that Java is so great to work with, and IMO has a lot to do with the language's success.
I really liked programming in Ada. I hated it at first (coming from being a C hacker in college) but in hindsight, it's the only language I've used that left me a better programmer.wordclock records