in reply to Re: if (ref $value eq "ARRAY") {
in thread if (ref $value eq "ARRAY") {
Even if you could recover gracefully from wrong input, it's probably a bad idea. If you get wrong input, then somewhere along the line someone screwed up, and about the worst thing you can do is hide the problem (or at least pass it on to another chunk of code further away from the original) and make it harder to debug. That sort of false "defensive programming" isn't just a waste of time, it's actively harmful.
In general, I like to write code that fails -- gracefully, mind you, not locking up the machine or any such -- as soon as possible on bad assumptions. Makes it easier to find bugs.
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: if (ref $value eq "ARRAY") {
by Aristotle (Chancellor) on Aug 24, 2002 at 04:07 UTC |