note
FoxtrotUniform
<p>Who was it that suggested the "Principle of Least
Surprise" for component behaviour? I'd say this is
a rather gross violation of that rule. Sure, it's
great to tell the programmer that they may have
called the function improperly, but to <tt>die</tt>
on ill-formed input, especially in a function that's
supposed to check for validity, is extreme. (By all
means <tt>carp</tt> about strange input -- bonus
points if you provide a flag for debugging output,
so that end users don't have to wade through a huge
cascade of "hey, programmer, I think you've messed
up" messages from a smart-ass module.)</p>
<p>As an aside, I can't stand the name
'<tt>check_date</tt>' for that function. Okay, it
checks the date, but what does it do after checking
the date? Die with an error? Return true ("yes,
it's valid")? Return false ("yes, it's bogus")?
Set a flag somewhere? How about <tt>is_valid_date</tt>
instead?</p>
<p><tt>-- <br>
:wq</tt></p>
155421
155421