Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Perl Style: Is initializing variables considered taboo?

by BrowserUk (Patriarch)
on Aug 21, 2010 at 17:08 UTC ( [id://856485]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Perl Style: Is initializing variables considered taboo?
in thread Perl Style: Is initializing variables considered taboo?

.which describes "already initialized".

In which case you need to reinitilise them.

IMHO your intention is to control the scope of a variable.

You're telling me what my [sic] intent was?

My intent was to state that initialisation to undef is unnecessary when you use my. Nothing more and nothing less.

As for you "scoping" missive:

  • our limits visibility, not scope.
  • state persists scope, not limits it.
  • local limits scope temporarially, but not reliably.

    If you localise a var, but then call some sub or method that uses it without localising it, you get screwed over.

But quite why you feel the need to tell me (wrongly) about these things I don't understand, because I'm pretty sure that you're aware that I know they exist, and what they do. And they have no bearing on what I said.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: Perl Style: Is initializing variables considered taboo?

Replies are listed 'Best First'.
Re^6: Perl Style: Is initializing variables considered taboo?
by LanX (Saint) on Aug 21, 2010 at 17:16 UTC
    My intention is to have a consistent terminology,

    It doesn't worth it discussing things if everyone has his own vocabulary.

    Talking about our, state, local I disagree. The term "scope" can be characterized as dynamic OR static, it has compilation and runtime aspects.

    Just grep thru the perldocs.

    But since we both exactly know how they work I'll quit this discussion.

    Cheers Rolf

    PS: maybe worth a look http://perldoc.perl.org/perlglossary.html

      Talking about our, state, local I disagree.

      Then you are wrong!

      The term "scope" can be characterized as dynamic OR static, it has compilation and runtime aspects.

      True. But that has no affect on how those keywords affect scope.

      • our limits visibility, not scope.

        our only affects dynamically scoped variables. Their scope remains global, our just makes them visible within the current lexical context.

      • state persists scope, not limits it.

        It allows a lexical variable to retain its value beyond its lexical lifetime. It extends rather than restricts it.

      • local limits scope temporarially, but not reliably.

        If you localise a (dynamic) var, but then call some sub or method that uses it without localising it, you get screwed over.

      But since we both exactly know how they work

      Hm. Do you? It doesn't seem that way.

      I'll quit this discussion

      Good idea.

        Well, I thought I could learn anything new when I asked why your limiting to "my".

        > > I'll quit this discussion
        > Good idea.

        ... and once again I wasted time! :(

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found