The Problems of Perl: The Future of Bugzilla
Nick Barnes
Nick.Barnes at pobox.com
Sun May 13 17:23:11 UTC 2007
At 2007-05-13 15:24:35+0000, "Aaron Trevena" writes:
> On 13/05/07, Nick Barnes <Nick.Barnes at pobox.com> wrote:
> > At 2007-05-12 10:08:02+0000, "Aaron Trevena" writes:
> >
> > > IME that isn't true. Mitigating for Python's poor error reporting,
> > > Ruby's poor performance and or reinventing wheels in Ruby are costly.
> >
> > A number of people have mentioned the quality of error reporting as a
> > strike against Python. Can any of these people provide a concrete
> > example of what they are talking about? With source code, and a
> > misleading or confusing error message?
>
> ...because I keep a file of such things to hand.. not ;)
>
> from memory :
> >>
> syntax error at Line XXX
> @common.something
> <<
OK, that's from your memory. Now this is from Python itself:
$
$ python bugzilla.py
File "bugzilla.py", line 46
def init(self, db, $config):
^
SyntaxError: invalid syntax
$
What's unclear about that? Note the handy caret, indicating the
offending character at which Python's lexer (understandably) barfs. I
can't parse your "@common.something" line. Is that supposed to
resemble part of a Python error message?
> Except in Perl I'll get a whole lot more, such as 'expected foo' or
> 'unexpected foo' or 'undeclared bar' or 'runaway quote at line xxx',
Are these syntax errors? ('runaway quote' is, of course). Python, of
course, has gloriously simple syntax, so syntax errors are fairly
unusual in the first place, and are almost always trivial to fix.
Other errors (e.g. runtime exceptions) are reported comprehensively in
Python.
Python certainly has many faults (for instance, I think that the
indentation syntax is a mistake; also it doesn't have strong static
typing, simple syntax for higher-order functions, or a type-safe
module language). But error reporting really isn't one of them. And
if we start discussing syntax errors in this thread, we are bound to
end up in a discussion of syntax itself, and Perl fans might prefer to
avoid that line of argument. Perl, by design, puts complex
functionality into the syntax. Python, by design, keeps the syntax
simple and consistent and puts functionality into library modules.
> as for debugging.. did you ever bother to are tee eff em?
Please try to be less offensive. Of course I've read the manual. Of
course I've used perl -d. In fact I end up using this rather cranky
tool every single time I write any code for Bugzilla, because getting
the twisty Perl syntax correct, even for something trivial, takes me
four or five attempts. My debugging print statements always break the
parser on the first attempt, tell me that my variable is a HASH on the
second attempt, reveal how many entries it contains on the third
attempt, break the parser on the fourth attempt, and finally tell me
the value that I'm after on the fifth or sixth attempt. That's if I
get the funky string quotation/expression anti-quotation rules
straight.
Nick B
More information about the developers
mailing list