[r6rs-discuss] [Formal] Allow compilers to reject obvious violations

Per Bothner per at bothner.com
Mon Feb 26 03:11:42 EST 2007


Jon Wilson wrote:
> I would prefer a compiler not to complain about bugs I am already plenty 
> aware of.  A bug-catching feature is only useful when it catches 
> something new and unknown.  If I have to do extra work in order to do 
> some quick and dirty testing, then the compiler's bug catching features 
> have gotten in the way.  I think that this is Arthur's POV.  Perhaps you 
> understand it better now.

I understand it, but it seems an amateurish way of working.
If you have a bug you're plenty aware of, it's almost always easy to
fix it at least to the extent of shutting up the compiler.  After all,
people do that every day in C and C++.

I *want* the compiler to catch my bugs when I do some "quick and
dirty testing" so *I* don't have to hunt down trivial bugs.

Some compilers have a way of annotating code to turn off a specific
warning in a specific location.  This is useful for the very rare cases
when fixing a particular warning is difficult, in a project which is
built in warnings-are-errors mode.

An exception I can think of is when you've gotten a pile of someone
else's buggy code, and it's hard to fix it all at once.

> I agree that automated bug catching is a useful tool, or a useful 
> option.  However, perhaps it is not the job of the compiler insofar as 
> it is a compiler.  I would favor more of a separation of concerns.  Let 
> the compiler merely compile, and let a lint-like tool catch bugs.

Well, the world has generally moved away from that model.  Nowadays
error-checking is built into compilers and/or IDEs.  Running a separate
lint step takes longer, and is therefore less likely to be done.  And
you want the error-checking on by default *every* time you run the
compiler, so you can catch and fix the errors as quickly as possibly,
when the code is fresh in your mind.

> Perhaps the compiler should invoke the lint, at the user's discretion, 
> but I don't think a standard should mandate that a compiler do anything 
> other than translate source code into machine code (or bytecode or 
> whathaveyou).

The question isn't *mandating* that the compiler do any checking; the
question is *allowing* a compiler to refuse to compile an erroneous
program.
-- 
	--Per Bothner
per at bothner.com   http://per.bothner.com/



More information about the r6rs-discuss mailing list