Damian Conway On Programming, Perl And More
Andrew writes: "My host pair.com has an
interview with Damian Conway
in which he talks a lot about his upcoming modules, and what skills
a Perl programmer needs. I'm personally waiting on
Parse::FastDescent." Conway talks about some interesting modules he's working on, Perl 6, and on programming in general, too.
Also, what do you mean they like to write short and clever programs? Doesn't everyone?
= 2) +=$f=!fork;map{$P=$P[$f^ord
[ P.]/&&
On a personal level, anyone who enjoys computer programming enjoys 'short and clever' programs.
On a personal level I appreciate that this is short and clever:
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^
close$_}%p;wait until$?;map{/^r/&&}%p;$_=$d[$q];sleep rand(2)if/\S/;print
However, I think you will understand that no serious professional programmer would use this type of programming in a professional context.
Of course, the above example is extreme, but it has to be said that many "perl gurus" enjoy this type of cleverness and cannot stop themselves even in situations where it is inappropriate.
Most professional programmers understand that "short and clever" is very often bad in a large software project. Read, for instance, Code complete by McConnel.
Just as the -- what is it? Program Extraction & Report Language (P.E.R.L.?) -- language grew from one-time Seattleite Larry Wall's kludgey geek code into the major glue that holds the entire World Wide Web together, so also the Mentifex Call to AI has stormed the far reaches of the 'Net and now needs Perl programmers everywhere to take up the once-in-a-species-lifetime Herculean task of creating Open Source Artificial Intelligence.
But Perl's just a scripting language... you may say dubiously and faith-lackingly. Fear ye not, for from the tiny acorn of Perl shall grow the mighty oak of Technological Singularity.
The original 26nov1994 Amiga Mind.Rexx AI used an IBM scripting language (REXX), whose ardent promoters are still licking their wounds from having lost the Web battle to Perl.
Although the AI Mind moved into old-fashioned Forth for robots, it quickly moved back into the scripting language of JavaScript, so Perl will hold its own against Visual Basic Mind.vb and against the object-oriented Mind.Java AI.
Perl programmers, do not be a dim bulb about whom people will say:
- "He is not the brightest crayon in the box."
- "His brain-waves do not reach the shore."
- "Er hat nicht alle Tassen im Schrank."
- "If you gave him half a brain, he'd have half a brain."
- "He's not playing with a full deck."
- "He suffers from weapons-grade stupidity -- it's dangerous to go near him."
Think different! Use your Perl skills to join in the last great intellectual Gotterdammerung of the human species.
Printing an array of hashes in Perl (lifted from O'Reilly book):
.. $#LoH ) {
.. $#$foo ) {
# print the whole thing one at a time
for $i ( 0
for $role ( keys %{ $LoH[$i] } ) {
print "$i: $role is $LoH[$i]{$role}\n";
}
}
in Python:
for i in range(len(list)):
for key in list[i].keys():
print i, ": " + key + " is " + list[i][key]
Consider line 2 of both examples. Perl's contains 11 non-alphanumeric typographical symbols. Python's contains 6. On a purely visual level alone, I can't imagine anyone preferring to maintain the former over the latter. Furthermore, Perl requires the explicit "% { }" foo so that it knows it's dealing with a hash, an issue Python doesn't face. (Orthogonality... now _there's_ a concept!)
Now take the above Perl example and imagine if you're using a _reference_ to an array of hashes, as in:
foo = \@LoH;
for $i ( 0
for $role ( keys %{ $$foo[$i] } ) {
print "$i: $role is $$foo[$i]{$role} \n";
}
}
Sweet Jesus, my eyes are hurting! I started using Python 6 months ago and for general purpose scripting, I swear I'll never go back to Perl if I'm not forced to.