On Fri, Sep 26, 2008 at 1:10 PM, Brion Vibber
<brion(a)wikimedia.org> wrote:
A runtime error still gives you more useful
information while developing
and debugging than silently passing through a string which, at some
unspecified future time, doesn't do what you expected.
Which is why the alternative we were discussing was having the
functions validate their own input and raise a warning or error if
passed bad input. That also provides runtime failure, which would be
at least as descriptive. More descriptive if we threw an exception,
since it would give a stack trace -- although less descriptive if it
just raised a warning, unless the warning said what line of code the
caller was on. Is it possible to figure out the caller without
parsing debug_backtrace() or something similarly horrible?
If constants are passed
as function arguments as they usually are, the
warning would occur on the calling line, not in the function itself, so
you immediately know who the caller is.
Roan Kattouw (Catrope)