Yeah, but the point is that variables can also encapsulate behaivor, and variables can also occupy a heirarchy of namespaces

Under certain circumstances this is true, but I would say its the exception rather than the rule. Unless of course you care to elaborate on what exactly you mean by "variables encapsulating behavior" outside of tied variables.

So, a "global function" really isn't any better than a "global variable". They're both just globals.

Yup, very true, just one more reason to always use packages, then your functions will never have to be global ;-)

Although, I will say that the one (very important) difference between global functions and global variables is that one contains state and the other does not (barring things like closures and other assorted silliness). It is tracking all the state transistions that make global variable (all variables actually) difficult and unweildy.

There is a reason why most functional languages either do not have assignment (Haskell), have single assignment variables (Erlang) or have large caveats surrounding their more imperiative features (LISP, ML, etc). A program is much easier to reason about and study when you dont have a rat's nest of state transitions to follow. If your program can be looked at as one giant (highly complex) expression, it becomes much easier to prove a level of 'correctness' for your program.

-stvn

In reply to Re^14: Wassercrats::Improved Volume 0, Number 0 by stvn
in thread Perl::Improved Volume 0, Number 0 by Wassercrats

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.