Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

proof that perl is poetry (?)

by mcwee (Pilgrim)
on Jun 03, 2000 at 01:14 UTC ( [id://16131]=perlmeditation: print w/replies, xml ) Need Help??

Honest, this is a meditation on Perl, it just takes some back-story for the meditation to make sense. So, bear with me.

I studied Comparative Lit and Creative Writing (fiction, thanks for asking) in college. I had soured on poetry in high school (too much prolix purple prose will do it to even the best of us,) and subsequently did my damnedest to avoid poetry classes at all cost while attending Famous Midwestern University. But, because I was in Comp Lit, there was no way to avoid dreaded verse completely, and I subsequently ended up taking an intro level poetry class during the last semester of my senior year (aside: I was teaching at a local high school at the same time, and some of my students were actually older than my poetry classmates-- and it really showed, too. Creepy.) I ended up learning a lot in that class, and feel like sort of a heel for having been so obstinate about poetry.

One of the things that the class focused on was that "poetry is language made efficient" (either Pound or Eliot said that, can't recall which.) Which is to say that it is "packed" language. Thus, any proper paraphrase of a poem (that is, a paraphrase which covers all the bases clearly without drifting into critique, interpretation or summarization) will, of necessity, be longer than the poem it is paraphrasing. Correlative: If you produce a paraphrase which is shorter than the poem it's paraphrasing, then, by definition, that paraphrase is itself also a poem (and, for that matter, probably superior to the poem it paraphrases.)

So, a few months ago, I was cleaning up a pearl script for a friend to use. She wasn't very familiar with Perl (hell, I'm not that familiar with Perl, not compared to most other monks) and so I was adding detailed remarks to the code in order to clarify what was doing what to which and whom. I was plowing through, head down, teasing apart in excruciating detail what opens which, why it does it and why it does it just then. I sat back from my labors and realized that I'd more than doubled the size of my file; the blocks of remark-text now loomed around the code itself like Stonehenge around dandelions.

And I had a sudden moment of epiphany. I was looking at empirical evidence of the very real similarity between poetry and Perl: my annotations to the code dwarfed what they sought to describe and the only way for it too have been otherwise would be for the explanation to be in Perl.

Splash!

I was awed.

(Side)-effect: Ever since, my coding has been much more fluid, graceful and compact.

Basho tells it like it is:

When the old pond gets a new frog it's a new pond.

Replies are listed 'Best First'.
RE: proof that perl is poetry (?)
by Hyler (Sexton) on Jun 03, 2000 at 14:55 UTC
    What if your friend had written the comments?
    One thing I like is that "There's more than one way to do it.". You can use $. or you can use &printlinenumber();

    There is a metric buttload of books written on software maintenance. One example I saw regarding commenting code and using terse variable names was along the lines of(pseudocode)

    F_CNT=F_CNT+1; # Select the next flight
    versus
    FLIGHTCOUNTER=FLIGHTCOUNTER+1
    The first one requires at least ten more keypresses.

    So, in Perl, you have to comment. But I suggest thatyou keep the comments in the beginning of the script(s) and/or in the beginning of a function call or sub, kind of like in """that snake language""" or in /** JavaDoc */. Better than intermingled everywhere.

    Makes Perl a pleasure to read, as always...

RE: proof that perl is poetry (?)
by ivory (Pilgrim) on Jun 05, 2000 at 14:45 UTC
    Pretty cool...I never really thought of it that way. But really if you think about it, you doubled the size of you file by adding comments to the code. If you took the code out and just explained what happens in the proggie, it would be smaller :P --Ivory
RE: proof that perl is poetry (?)
by rbrito (Acolyte) on Jun 06, 2000 at 05:16 UTC

    I'll keep this short for the sake of poetry. :-)

    This "phenomenon" is, in fact, understandable (and even expected): since Perl is a sufficiently high level language, you can write shorter programs, with each syntactic part of the phrases having a lot of semantic importance for the whole communication.

    In any context where you have a high level use of a given language (including here the natural languages), you put a lot of burden of the interpretation process in the receiving part.

    In the case of human languages, this is obvious: many figures of speech (e.g., metaphors), while powerful and, at the same time, terse, require a deeper understanding of the language from the reader/listener.

    So is the case of Perl: depending on your use of Perl, the perl interpreter has to do a lot of hard work to keep your "freedom of speech" (or poetry, if you will).

    Cheers, Roger...

RE: proof that perl is poetry (?)
by buzzcutbuddha (Chaplain) on Jun 05, 2000 at 16:32 UTC
    If I could vote you up again McWee, I would.
    I got turned off of the English Lit in college due to the "evil p's":
    pretentious prolix purple prose. Or as one of my friends would say
    "tossing pointless verbal hand grenades."
    Great piece.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://16131]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2024-03-28 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found