Exegesis 6 (Perl 6 Subroutines) Released
chromatic writes "Perl.com has just published Damian Conway's Exegesis 6 which gives practical examples demonstrating how to use the new subroutine and method semantics in Perl 6. This is the companion to Larry Wall's Apocalypse 6 which discussed the changes planned for subroutines in Perl 6."
I mean, whitespace hasn't even been made meaningful yet.
Where's $\space and $\tab ?
The one thing that I always found unpleasant when moving between languages was the keywords... so, I picked up a C book, migrated to C++, then Java, picked up PHP along the way. Everything was fairly similar with keywords and syntax, and then perl threw a monkey wrench into the mix. I've never looked at python, are there similarities there or are the perl gurus guiding us through their path of enlightenment?
--------
Free your mind.
- Everyone in the world had a chance to submit RFCs
- Larry is taking each section of the 3rd edition Programming Perl and turning it into a white-paper on the way Perl 6 will work, using the RFCs that touch on that section of Perl as a sort of shopping list, and accepting, modifying or rejecting them as needed. These are called the Apocalypses.
- After an Apocolypse is out, Damian starts working on some real-world examples to make it all more concrete. These are called the Exegeses. Sometimes these also have examples of syntax and semantics that have been worked out via the mailing lists
- Eventually, this will lead to the Design Documents
Hope that helps clear this up for those who aren't sure what's going on when they see a new Apocolypse or Exegesis come forth.Why would someone who is reading an article about Perl 6 Subroutines need a copy of Learning Perl?
Why did you post the Amazon review without giving credit?
Why will your post be moderated up nonetheless?
Well, it seems like I have to re-learn lots of stuff about perl. Although I somewhat like the new syntax. Finally, perl has call by value and call by reference. Now, when will we get _real_ pointers? *ducks away to dodge the pelting of rocks in my direction* ;)
sub Fahrenheit_to_Kelvin (Num $temp is rw) {
... ; :-)
Verbosity in coding, yeah that will go over well with people who are used to
int lbn, rax,
Don't get me wrong I'm a big fan of Perl, but not for its completeness as a language but for the ability to quickly write small utils to parse text.
But I suppose whatever floats peoples boats.
Tom
Someday, I'll have a real sig.
- Eventually, this will lead to the Design Documents
And everyone will then use Python.One of the goals of Perl 6 is to make non-trivial projects possible. That's good. The way it's being done is bad. Perl was once a lightweight, extremely flexible language. Now it's become a huge ugly monster. People wanted OO, so a nasty hack was bolted on top to allow some semblance of it. Now this nasty hack is being expanded. Sure, the code's different, but the basic form is the same. Kludge upon kludge upon kludge; I'd much rather have a nice, clean, pure language (and not one with loads of irritating whitespace thank you very much).
The same goes for the syntax. All the switching between $, @ and % is really irritating (ask a newbie how to get at the length of the keys array of a hash inside a hash, for example), and the changes proposed for 6 are just making this worse -- it seems that Larry, in his infinite wisdom, wants to prefix every data type with a different hard-to-type character. Perl was only designed for the three data types, and adding more is a mess.
Perl 6 is a complete rewrite, but it keeps all the mess which has accumulated over the previous versions. This is not good. Sure, my const int $var = 27; may look neat (in the same way that, say, Pascal does), but $var isn't entirely constant, or entirely an integer, it's just a hack which makes it sort of behave like one. The whole thing is an exercise in pseudo-computer science masturbation with little real purpose except to please the managers who dislike the one thing that makes Perl special.
On a similar note is regexes. I'm an avid fan of regular expressions simply because a nondeterministic finite automata is far more flexible than linear code. However, Larry must have been smoking that cheap $2 crack when he wrote this. Does he want Perl 6 to be flex or something?
I won't be going on to use 6. It's a nice idea, but it's completely unnecessary. It won't make large projects any easier to manage (the language is still, at heart, an almighty hack -- an impressive one, but still a hack). It won't make OO any cleaner. It won't make development any faster. I'd prefer to use a language which has always been pure synthesis of science and engineering, not some half-baked imposter.
Perl 6 will be nice, but I'm guessing it will be the end of Perl. It can't do what it wants to do whilst still being based upon a nasty mess. There are now other options, which provide all of Perl's power and none of the mess. Sorry, but *BSD^H^H^H^H Perl is dying.
Thank God Damian isn't working on the Apocalypses...
Yes.
You don't have to! You could just as well use:
Perl will allow either. It's your choice. You can do the quick one-off-hack-it-up-at-3am-after-two-large-pots-of- coffee, and you can have a large programming project that must be maintained for years to come.
You have the choice. Pick whichever method fits the task at hand.
20 mil and I will! Learn Esperanto with 20M others.
Now, the guy:
obviously knows what he is talking about (even if he (horror!) pasted from his own posting from other website).
has something to say
Why don't you people listen and learn even if you do not agree with the poster?
i went to #SHAA and found that it was empty, damn you
the language is becoming more obtuse if thats possible. The perl programmers I know don't get along well with other languages, mostly because they have spent so much time learning the intricacies of Perl syntax. Even coming from C, Perl syntax is unnatural. Seems like once you go Perl, you can never go back (or try to learn a new language). I've never met a perl programmer who could tell me what a design pattern is either. I guess they don't go for re-use much in perl progging. I think if I went to hell, satan would probably make me write a Perl parser. (without the help of Yacc)
TallGreen CMS hosting
And everyone will then use Python
;-)
Normally, I would not reply to a troll, but this one allows me to bring up an interesting point for those polarists that think Perl and Python are somehow diametrically opposed.
While they certainly have different approaches to language design, Parrot (the Perl 6 back-end) will have front-ends for many languages. One of them will, in fact, be Python.
So, will everyone "then use Python", well perhaps, but if they do, they'll be using Perl 6
This guy is not trolling. He makes several valid points. Perl 5 is a good thing if you need to transform text or write a CGI program. For anything longer than a few hundred lines you should probably use something else. That is the way its been and the way it will be. Perl reached the limits of its usefulness a long ago. Perl 6 and its rabid following are on the long road to nowhere.
an ill wind that blows no good
Or, to paraphrase:
The ridged top surface and the nondescript gray color will ultimately make this the final revision of duct tape before it dies a slow death. Execution will be drastically slowed by the difficulty in ripping the tape by hand, and the gray color will make it blend in with metal components, making interoperability harder and harder.
I mean, come on. Everyone whose job description involves building entire apps in Perl, please raise your hand. Then bring it down sharply into your groin, because you should not reproduce.
Perl is still the best damn duct tape money can buy, and will be for years to come.
I've never seen a language with so much syntax. Perl 5 had more than enough, now they've more than doubled it.
:= and ::=, ~=, ~~, .... = does assignment, := does binding and ::= works at compile time and is normally used to define types and such, ~= is pattern matching, and I have no idea what ~~ does.
...
You have { } for blocks, and for automatically parameterized blocks (ie. anonymous functions).
You have =,
You have the new <== and ==> pipeline operators. They are dataflow operators. Like so:
$foo ==> my_func ==> $bar;
is the same as
$bar <== my_func <== $foo
is the same as
$bar = my_func($foo);
is the same as
You already had the $,@,%,& to prefix variables with.
You have more uses for * now, as in slurpy arrays and splicing. As in, the * can make an array parameter slurp up all the remaining arguments, or it can make an argument flatten into a list of arguments.
They've added some wierd << foo >> syntax that I didn't even bother to read about as I was in syntax shock.
They've added ^ which indicates that a variable in a block is actually a parameter and therefore the blocks is actually a parameterized blocks (ie. anonymous function). So, now you can't tell if something surrounded by { }'s is just a block of code or whether it's an anonymous function. Although, I don't think this is a problem as it's usually obvious from the context.
And I didn't even read to the end of the paper!
Makes me want to go write some Lisp, which is perhaps the antithesis of Perl. Lisp has the maximum possibile flexibility through having the minimum possible syntax. Perl originally had little flexibility, now they are trying to add more by adding more syntax. The problem is, if they want to get anywhere near Lisp-level flexibility with this method they'll need to move to Unicode for the syntax!
Justin Dubs
$IR HAXALOT IS A MONEY TROLL. He posts book links all day long because HE HAS A REFERRAL PARTNER ACCOUNT WITH AMAZON. $irHaxalot should be MODDED DOWN ON SIGHT. He DOES NOT READ the books he is recommending.
oh, and sorry about the Perl applications thing. That is for my friend, who has stopped responding to instant messenger or email because he's mad at me. I'm pretty sure he Slashdot, though. ;)
:) We gotta set something up the next time I'm in the area, a LAN or something.
He was always talking about how he would be a Perl application developer, because Perl was so leet. I think it's leet, but only really shines for duct tape work.
Jeremy, if you are reading this -- stop being such a little bitch and respond to my emails, dammit!
You don't know what you're talking about. Weakly typed languages have nothing to do with script programmers not being able to specify types(what is that supposed to mean?), it is purely a convenience, and helps reduce the number of variables and lines of code required to get a job done. Really, it does.
Someone else already posted an example.
int a=1; WriteLine("a is type {0} and has value {1}", a.GetType().ToString(), a.ToString());
The beauty of it is when you translate the text. The translator now has option of moving parameters around inside the text. Awesome.
I admit, that is pretty cool.
Sticking feathers up your butt does not make you a chicken - Tyler Durden
there goes my evening...
they have perl on computers now? thats unpossible!
I came to the datacenter drunk with a fake ID, don't you want to be just like me?
Shortly after I started reading Exegesis 6 I was somewhat frightened by how complex Perl had become since I stopped keeping track of updates. Of course scripting languages have always been known for borrowing the best from other programming languages, so I kept reading in the hopes that I'd recognise something. I saw some features like the is constant declaration and started worrying that maybe they'd decided to borrow some features from the very popular but insanely evil Visual Basic. But then I saw this:
and realised that, just as Python is (alleged to be?) adding Lisp-like features, Perl is adding ML-like features! That line above is (minus the '::' and ';') straight out of a Haskell program. Then I started to notice more Haskell-like syntax:
feed (Cat c) =
feed (Lion l) =
And I'm sure a more thorough reading would turn up even more. (For example, the smart-match operator reminds me of the type inferences done in a Hindley-Milner type system.) So it appears that any sufficiently advanced language contains an implementation of a purely functional language, not specifically Scheme. :) Has Damian (who certainly has Haskell exposure) or Larry ever mentioned any of these influences?
One more thing:
I'm really happy to see Perl include currying, I can't think of a programming language that I would be completely happy using without it.
"all(<<your base>>) are Belong("to us");" is now a legal Perl 6 statement. I'm fairly certain that's one of the signs of the impending Apocalypse (umm... pun not intended).
sed 's/In Soviet Russia/In NSA America/g' < yakov-smirnoff-jokes.txt
If you're gonna troll, atleast do it well. Or just don't.
"Last one in is a rotten goblin!" - Kepp
Perhaps the Perl motto should be changed from TMTOWTDI to TAMODVPCWDSSAAMSTWDI:
"There's a multitude of different visually pleasing constructions with deceptively subtle syntax and auto-magical semantics that will do it."
Okay, I love Perl 5... Perl 6 looks really cool but overwhelming. I'm glad they're adding the options for stricter type-checking and such, but remembering the syntactic shortcuts is gonna be even harder. I don't even want to know what the parser code looks like...
My bicyles
Huh? This seems wrong. Evaluating an array in a scalar context should return the size of the array, not an array reference.
In the denotational semantics community it was long ago decided that real programming languages are too messy and too much of moving targets for serious theoretical research. As a result, the most popular language is known as Idealised Algol which is a simplified and cleaned-up version of Algol-60 (I'm told Algol-W is the closest implementation).
Now that Perl 6 has a rich operator definition system*, we can look forward to Idealised Perl (IP). IP would be a version of Perl stripped down to only the necessary syntactic building-blocks. Even if much of Perl 6 were implemented in C, it'd be possible to define all the syntax in terms of IP. If you're writing code for maintainability instead of prototyping, using IP as much as possible will ensure a smaller learning curve for non-gurus. IP will be simple enough to actually allow teaching Perl in universities.
IP could be the elegant yet expressive language we all (whether we like Perl or not) wish Perl would be.
* This is, IMO, the only really neat and elegant thing to come out of Perl 6 so far. If operators can be defined to the point where most mathematical formulae are executable, Perl will become a revolutionary tool.
Is it just me, or is Perl 6 so different from Perl 5 that they probably should have given it another name? Especially since Perl 5 will continue to be updated after Perl 6 becomes stable?
Perl 6 has so little backwards compatibility, it'd probably be better if they just through out all the legacy syntax and started from scratch with a new language. Not that Perl ever was elegant, but I'm starting to worry that things are getting out of hand...
I like Perl. I use Perl often. I also know and use a variety of obtuse languages, including wacky ones like Forth, J, and Haskell, plus more traditional languages such as Python, C++, various BASIC derivatives, etc. In short, I'm not an anti-Perl troll. Blind language advocacy is for newbies.
That said, I can't help but think that far too much thought has been put into Perl. One of Perl's real strengths has always been that it wasn't designed up front so much as accreting things have have been proven to work: hashes, formats, regular expressions, dynamic typing, back quoting, evaluation of variables inside strings, and so on. But Perl 6 is getting years of forethought, and all of that forethought is beginning to weigh things down. The old Perl way would have been to say "Look, now we have a simple parameter passing scheme like that one Python, one which has been proven to work." The Perl 6 way is to start with a series of odd little features, then keep modifying them and adding sugar to them until the end result, after a number of iterations of this, ends up being something that looks and works like Python's parameter passing scheme, but takes ten pages of explaining to fully explain,
In short, this is the kind of thinking that begat PL/1 and Ada and other spectacularly complex languages.
(1) Draw a complete operator precedence chart for C.
(2) Draw a complete operator precedence chart for C++.
(3) Draw a complete operator precedence chart for Perl 5.
(4) Draw a complete operator precedence chart for Perl 6.
Perl's ability to express complicated things concisely is nothing short of astonishing, but it's gotten to the point where I can hardly parse code written by someone else...
My bicyles
What a monster of a language!
...will someone please hurry up and add Unicode support to Ruby so that I don't have to learn Perl 6?
GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
Ow! My groin! I've been doing perl applications development for telecommunications for about three years. Lots of TN3270 screen scraping. Lots of painful TN3270 screen scraping.
The names are a running gag on church-latin, that interconnects Larry's linguisticism, Damian's eclecticism, and the monastic themery of the Perl Monks' alternate retroynm for .PM. Larry's Apocalypses are not apocalyptic in the common figurative sense (although the neo-Luddites who think the only improvement on Perl5 is PHP or Python may think so), but are the Revelations of the gur, which is the original sense of the word, before it came to be used to refer to the particularly apocalyptic content of St.John's Revelations also called Apocalypse in the latin. The churchly Exegeses are non-canonical explanations of the deeper meanings of the canonical texts. And of course, synopses are shorter summaries, like Cliff Notes (TM) or Master-Plots (TM), and were originally applied to religious writings of course.
DNA just wants to be free...
Read and understand the WHOLE article.
My initial reaction to most of the apocalypse/exegesis articles has been "WTF, this is so complicated they're going to destroy perl".
BUT, when you read the articles carefully and think about them, it becomes clear how powerful, and easy to read (yes, really) most perl 6 code will be in comparison with perl 5.
The apocalypse/exegesis articles by their very nature tend to dwell on difficult and complex issues and, true to its history, perl 6 will be taking ideas from many other languages which may be initially alien to perl 5 programmers. So, yes, we'll need some effort to get the hang of the new syntax, but I'm now 99% convinced it will be very similar to work with.
Lets also not forget the work on parrot - having an open source, fast VM should benefit other languages such as Ruby, Tcl and Python - it's been built with that in mind from day 1. If it comes off - yes its slow going, but the signs are still good - I hope this will help to silence the endlessly purile "my language's better than yours" that clutter up these pages (ok, I admit it wouldn't be as much fun!).
Two years of Parrot development and it still cannot run Perl. And as for this talk of Parrot running Python and Ruby - it's just talk.
Here is what a Python guru said about Parrot when he tried to port Python to it:
Parrot development is stalled
The VM hasn't yet been shown to be useful as a language target. The main list for Parrot development, perl6-internals, was started in September 2000. Over two years later, in March 2003, there are still no real languages running on the VM. There are only a few toy languages such as Befunge and Jako, and fragments of Perl, BASIC, and Scheme compilers that are far from being able to run any percentage of the Perl and Scheme programs out there. (They're at about the same level as parrot-gen.py; if you pick a random example from a book or a random program found on a web page, the chance of being able to successfully run it is essentially zero.) To some degree this is because Parrot is closely tied to the development of Perl 6, and Perl 6 development is also proceeding very slowly.
No obvious benefit from using Parrot
What new possibilities does Parrot provide for Python? Stacklessness? Better GC? A new I/O layer? Interoperability with other languages? None of these is more than mildly interesting to me, and none, I suspect, will be viewed as a killer application by the Python community in general.
Most of the claimed benefits, such as better performance, haven't been actually demonstrated at this point. There are no real languages running on Parrot, so you can't compare the standard implementation of language X to the Parrot version of language X. Instead it's simply stated that Parrot will be faster than existing language implementations, but proof-by-assertion isn't very convincing.
regarding this syntax:
--
(Num $temp is rw)
--
ick - this type of syntax is why I don't like VB. anyone with me here?
we are all one consciousness experiencing itself subjectively - bill hicks
* Eventually, this will lead to the Design Documents
That's all well and good, but how far into the actual development have they gotten? I mean, it's kind of cool that they're saying "Perl 6 will do this, that, and the other thing", but how much actual work have they done?
All this time, I've sort of thought that Perl 6 development was well under way and that they were nearing completion, but your post makes it sound like Perl 6 is nothing but talk right now.
I don't know which gets more trolls... Perl or VB6... or VB.Net or C# or Java or Python.
I think it merits a poll.
My vote: Perl.
Most languages have regular expression components now to help with text processing.... so can someone tell me why you would pick up Perl when other languages are prototypical (VB/Python), strongly OOP (Java/C#), or need to be around forever because people have been coding them for decades(COBOL, C, C++)?
Note: Personal preference is Java, Python, and VB.Net in that order. I am now entering the bunker to avoid thermonuclear flaming.
(waits)
This space for rent.
please see http://xahlee.org/UnixResource_dir/perlr.html xah lee
I see Perl 6 as kind of a pantheon of programming gurus, and you can subscribe to whichever you like (or tell them all to screw off). The most important thing about Perl 6 is you can use whatever programming style suits you best. In a corporate environment, that style can even be dictated down by the powers that be, too. If you're one of those people that thinks that Lisp (et all) is (or is not) understandable, or thinks Java is a brain-dead C++, or that C++ is error prone Java, then Perl 6 may not be for you. You let (percieved) flaws obscure the important benefits, and as a result you miss out. Objectively, you would be examining the trade off between learning curve and increased efficiency over the time period of the project. In many cases, it is in fact better to stick with the tool you know, even if a different tool would be twice as effecient. Since it's just not possible to learn every single tool available, as professionals, we have to pick the most effective set of tools that we care to know given our interests and other expertise. This brings us around to the great thing about Perl 6: in one cohesive, sensible framework, it gives you really broad coverage. You don't have to learn it all at once--you start out using Perl 6 like Perl 5; then when you decide you want to do some lispy type things, you don't have to learn Lisp and a whole new toolchain, you can learn to do lispy types things in Perl. If you want to do things that would be well suited for C++ templates, you can learn the Perl 6 mechanisms for it instead of undertaking C++. And what is really, amazingly cool is that Perl 6 is shaping up to be a cohesive, well considered framework; it's not a jumble of competing ideas that don't play nicely with each other.
If you've worked with C++ templates and metaprogramming, then you certainly understand the benefits being offered by a lot of the Perl 6 constructs. But the Perl 6 way is much more comprehensive, direct, clear, and intentional. Everything with blocks, anonymous subs, closures, multi methods, named parameters, operator overloading, and macors offers unbelievable oportunities for meta-programming. Once Perl 6 gets rolling and starts developing its own equivalent of Boost, then programming will never be the same. Boost changed everything already, but you've probably never heard of it; but Perl 6 will have mainstream appeal, acceptance, and use that Boost will never have.
There have been quite a few comments about Perl 6 gaining too much syntax, but I can't help but think that you could make the same argument about the English language. There are many words out there that most of us don't need, but for some people, they greatly simplify communicating within their field. I think Perl 6 will actually be easier to learn than Perl 5, because a Learning Perl book would not need to even touch on some of the more advanced areas, and the simple areas have been, well, simplified.
"It may be remarked in passing that success is an ugly thing. Men are deceived by its false resemblences to merit."