Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: An Apology for Puncish

by Erez (Priest)
on Jan 28, 2009 at 08:58 UTC ( [id://739458]=note: print w/replies, xml ) Need Help??


in reply to An Apology for Puncish

The concept of the default variables is not without its linguistic roots.
Consider this sentence "Jack stood when Jill entered," and "he did it because she was tired".
This makes perfect sense, to anyone with fair reading skills. If you just started on reading, and are not familiar with the idea of context; or, if your overall reading comprehension skills aren't that good, you might need to explicitly read it as "Jack stood up when Jill entered, Jack stood up because Jill looked tired when she entered."

Now, if the second part of the sentence appeared 3 or 4 paragraphs later, there would be a need to use the explicit version of it, rather than the pronouns one.
In this sense, if the nature of the special variable is important to the understanding of the code, use English is a good practice. In the same way that naming your iteration variable is, at times, a good practice. Otherwise, feel free to be punc'd.

"A core tenant of the greater Perl philosophy is to trust that the developer knows enough to solve the problem" - Jay Shirley, A case for Catalyst.

Replies are listed 'Best First'.
Re^2: An Apology for Puncish
by rir (Vicar) on Jan 28, 2009 at 15:08 UTC
    Erez, I guess I agree with the first part of your post regarding "default variables" having a correlation to or derivation from pronouns. That is the standard wisdom and I have accepted it without much thought; the etymology of $_ has never seemed important enough to question. I would say that is just a fact that I collected. Whether it really is a fact, I don't know.

    The point I was making had nothing to do with default variables or pronoun-like tokens needing nearby antecedents. Nearby antecedents in language correlate to not acting at a distance in programming; these seem very different somehow.

    $_ is the accumulator of Perl; an ordinary pronoun needs an antecedent while $_ more often needs local-ization to break it away from its prior value. Between the two, the confusion we might get feels very similiar, but the mentation we should apply is inverted in some way.

    Be well
    rir

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-03-19 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found