Help a C++ coder see the light

Dave Brueck dave at pythonapocrypha.com
Thu Jan 30 18:16:40 EST 2003


On Thu, 30 Jan 2003, Brandon Van Every wrote:

> Dave Brueck wrote:
> > On Thu, 30 Jan 2003, Mark Charsley wrote:
> >
> >> I'm used to the compiler/linker giving me a lot of reassurance that
> >> my code works.
> >
> > That's common, but in many cases it's a _false_ sense of reassurance.
>
> It kills many problems before they arise.

Well, you didn't really elaborate so I can only guess what you meant, but
I can't think of any real-world problems it finds that aren't caught just
as adequately in the tests. Plus, it certainly doesn't catch algorithmic
errors, which tests do.

In any case, I don't think anyone is arguing that the compile-time checks
provide _zero_ benefit, only that the benefits are often overrated and are
sometimes mixed signals (such as the default arg example I cited earlier).

> > Even in C++ I end up checking all uses of a refactored function
> > despite what the compiler says because it can catch only the simplest
> > of problems.
>
> Sounds like your functions must do an awful lot if they need so much
> checking.

Why do you say that? What do you mean by "so much checking"? For some it's
a matter of just looking at the function call, for others it's walking
through the code. It really depends on what the refactorization was, no?

> Maybe your functions should be smaller, more incremental, easier to
> verify?

You're kidding, right?

-Dave





More information about the Python-list mailing list