note
BrowserUk
<blockquote><i>One may say that this effect may be avoided by remembering to carefully localize all package variables in all called functions, </i></blockquote>
<p>Unintended side effects are unintended side effects:<code>
sub G { our @ydata = 'Gaaaahh!'; };;
sub F{
my @a = @_;
print qq{pre-G: (@ydata)};
G();
print qq{post-G: (@ydata)};
};;
F(1..4);;
pre-G: ()
post-G: (Gaaaahh!)
</code>
<p>The problem has nothing to do with aliasing and everything to do with <b>not</b> [local]ising!
<p>Your previous quote is better stated as: <i>"don't use code that uses globals for no good reason."</i>.
<P> Which is doubly true for code that fails to [local]ise its use of globals.
<blockquote><i>a healthy dose of paranoia.</i></blockquote>
<p>Sorry, but I will always consider 'paranoia' in programming -- and pretty much everything else for that matter -- with exclusively negative connotations.
<p>The teaching of 'paranoia', rather than 'knowledge', in an attempt to avert disaster, is always a counter productive and ultimately futile process.
<p>With paranoia, one can <i>only hope to avert bad consequences</i>; with knowledge one can <b>know you have</b>.
<P>Don't hope, know!
<div class="pmsig"><div class="pmsig-171588">
<hr />
<font size=1 >
<div>With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'</div>
<div>Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.</div>
<div>"Science is about questioning the status quo. Questioning authority". </div>
<div>In the absence of evidence, opinion is indistinguishable from prejudice.
</div>
</font>
</div></div>
1017744
1017848