Apocalypse 2
Larry Wall has written the second article in his "Apocalypse" series about Perl6. If you missed the first article, you might want to read that one first, or see the previous discussion.
← Back to Stories (view on slashdot.org)
my $¾ = 0.75;
Just think of the time and space we'll be saving by using Han characters!
Karma karma karma karma karmeleon: it comes and goes, it comes and goes.
These first two had some resemblance to sh syntax for dis-ambiguating variable names:
"${foo[bar]}"
"${foo}[bar]"
This is horrid!!!!
"$foo\Q[bar]"
So much for Perl being like a bit of sh, awk and C!
I thought the same thing at first, but then realized it's only in " " strings.
As for reading what you wrote, sorry, but I can still read every perl script I ever wrote. If you can't, you're doing it wrong.
7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
--Ben
Perl 6 is to Perl as C++ is to C.
I bet Perl 6 is going to take a _loong_ time to catch on, if at all. Larry's taking one of the most complicated language syntaxes / semantics ever devised and piling on even _more_.
my int $pi is constant = 3.14;
my str $goodness!
Weird brackets
::sigh::
Use of brackets to disambiguate
"${foo[bar]}"
from
"${foo}[bar]"
will no longer be supported. Instead, the expression parser will always grab as much as it can, and you can make it quit at a particular point by interpolating a null string, specified by \Q:
"$foo\Q[bar]"
Okay, I'll admit it, I write Perl code.
I like writing perl code.
Why are they taking away something that let things be unambiguous and adding this? How can you provide nested unambiguous clues useing a two chatacter, non bracket combination?
Maybe its time to go learn Python. I can get used to white space indentation. This? I'm not sure.
This space for rent. All reasonable inquiries will be entertained at proprietors discretion.
No, it doesn't. It just makes it easier to query what the context is. But in perl5 you can make objects that behave differently in different context, including numeric context, boolean context, string context, iteration and the five types of dereferencing. Consult the 'overload' manual page.
-- Abigail
Perl's (and Larry's) "There's more than one way to do it" philosophy is fascinating as programming language theory, but when it comes to really designing something remember this: It's actually easier to write a sonnet than to write free verse. This may seem counterintuitive at first -- there are more rules to constrain you when you write a sonnet. It must be harder to do! But wait, if you're going to design something GOOD it's got to have to have some kind of consistent form and organization in the end anyway. If you write free verse you will have to craft that all yourself, choosing from an infinite possibility of ways to organize words. But if you write a sonnet, that's all taken care of: you just concentrate on the CONTENT, on what you want to say.
Larry might argue here that that's all well and good, but people still write plenty of free verse -- its probably more common today than ever, in fact. That may be true, but there's also probably more BAD free verse poetry today than ever as well. And brining this back to code, presumably we're actually talking about getting work done here, not expressing one's deepest feelings or inner angst with subtlety and tenderness. A good poem should be read a dozen times at least, and you'll get something more out of it on each read. A good program should only need to be read once. Subtlety that requires a dozen reads to notice is not a virtue! Going into an unfamiliar program knowing the form and syntax ahead of time just makes it that much easier to decipher.
So good luck to all you Perl poets out there. I wish you luck. But as for me, I think I'm going to check out Python over the summer. It looks like a language that won't force me to keep on thinking about low level design and syntactical form, but instead free me to think about CONTENT.
I also hear it's a pretty good scripting language for 3D apps (e.g. Alice3D and Disney's recent big switch to it.)
I say that, to the contrary, the biggest problem with almost all languages, open source or not,is that they froze to early. Take any language (Java, C, C++, Perl, Python), and you can quickly name some real flaws that the designers readily admit to, but have left alone for "consistency" purposes.
I understand your frustration with having to relearn the syntax, but I believe that if the best thing to do is to byte the bullet as early as possible and fix the flaws.
No?
--
TO BUY A NEW CAR WOULD MAKE YOU SEXUALLY ATTRACTIVE.
I too am a christian, your comment brought up many things that have been bothering me lately. I suppose the worst side of anything will be the most publicized, but its disturbing that recently the 'bible belt' had gotten so much attention, and is almost synonymous with christianity. As a christian i believe that these people stand against almost everything christianity is about. They spread hatred, fear and force their beliefs upon others, all three of which are said to be wrong in the new testament. Just as bad is that they put more value into the laws which they have imposed than the laws of God. They somehow mistake victorian morallity with christian morality. In doing this they become hypocrites, on the same level as the pharisees, the antagonists of the new testamate.
All I ask is that people understand that this small group does not represent all christians, most of us are intellegent, open minded people who do not agree with the views of the 'bible belt'.
Try this:
a = <<EOT
hello
there
EOT
b = "
hi
again"
c = %q(one (more)
time)
puts a, b, c
Result:
hello
there
hi
again
one (more)
time
I agree strings need some work - especially polynomial performance with repeat appends. However, there are at least three ways to do multiline strings.
However, it seems that Perl 6 will extend the concept of "context" still further!
So now you can get the wrong thing by expecting a number but accidentally creating a scalar rather than numeric context! You've got to have a new operator, presumably numeric(), to sit next to scalar()!
Will there be a context for every type, built-in and dynmically created, in Perl? Or will the contexts remain a weird wart on the type system?
I don't know what the right solution is, since Perl 6 would barely be Perl at all without the contexts, but moving away from contexts at least would be good.
I could be wrong here. I'm writing this mainly because for the most part I love Perl, and I'd be interested in being persuaded that context is a good thing and worht the potential for confusion, that it's better to have a distinction between
my $line = <FILE>;
my @wholething = <FILE>;
than having
my $line = FILE.line();
my @wholething = FILE.lines();
I think I'm intellectually inclined to feel that Python does most things the right way, but somehow I still find myself reaching for Perl when I need to get the job done...
--
Xenu loves you!
my $¾ = 0.75;
Perl. Can't live with it, Can't live without it.
Someone you trust is one of us.
Here is my one and only request for perl6:
/DECLSPEC.*\s\**([^\s\(]+)\(/ ) {
When running the 'Configure' script, make the questions a little more difficult. This will effectively weed out serious sysadmins and programmers from the newbies.
The perl6 configure script should keep track of the answers to their questions, and grade them on how many questions they've got correct.
Don't know which version of malloc to use??
Do you want to use vfork()? You sure?
NO PERL6 FOR YOU!!
Come on people, if you don't even know the size of the byte boundy on a double, how are you supposed to understand something like:
if (
Post the users name and email address on a public web site and let others view it. Email the results to their family, friends, and employers! Have a special list for those who ctrl-c before it's finished, call it the "chicken" list.
As a Christian, I have to say it's nice that people like Larry are out there to show we're not all stupid bumbling loonies (it's just Sturgeon's Law cropping up again, you know). If you've read any of his writings, especially his "State of the Onion" addresses, you'll see that he manages to present his thoughts and beliefs in a humorous and intelligent way.
Secondly, I really like the way he manages to make analogies between things. The first year he used sounds, the second year he used pictures, and the third year he used smells. And somehow he ends up with a grand scheme that addresses theology, science, computers, and, of course, Perl.
I think this is great, not just because the subject matter is interesting, but because to be any good at programming, you have to be able to map between different systems. The good ones don't seem to be as focused on depth (although they certainly can be; no one can argue that Knuth isn't good, and he's way hardcore) but on breadth of experience. The more different systems you experience, the more you can abstract the particular thing you have to be working on and actually transcend the implementation language and platform. (Or at least that's what I tell myself, being permanently scatterbrained and distractable :)
Anyway, I don't know how to keep this from sounding hopelessly fanboyish, but ummm Larry Wall is cool and learning new stuff is cool, and I recommend that everybody go read his stuff and then go play with something you've never tried before. Exploration is the One True Way to have fun with computers again.
--
TO BUY A NEW CAR WOULD MAKE YOU SEXUALLY ATTRACTIVE.
After playing with it for a while, I think it could be my new favorite language. My Ruby programs usually come out even more concise than Perl, but just as clean looking as Python.
Ruby needs more library support and some optimization work (I usually get about 4X slower than Perl), but I think that is an extremely promising contender in this space.