[plt-scheme] possibly useful new arity-checking tool: no-brainer

From: John Clements (clements at brinckerhoff.org)
Date: Fri Jan 31 16:51:11 EST 2003

I have written a small and possibly useful arity-checking tool for all 
language levels of DrScheme with the dreadful name "no-brainer".  The 
name is so bad that it pains me to put it in the subject line of the 
message, though as a search term it would be irresponsible not to. It 
is now available from the Utah scheme repository, at 

I am soliciting
a) better names for the tool,
b) an icon for the tool,
c) a less insulting name for the result window, and
d) code to improve the tool.

For those who might be interested, I include the current doc.txt file, 
describing the tool and its operation:

The _No-Brainer_ Tool
The _No_Brain_ Tool

The No-Brainer Tool, essentially an exercise in syntactic abstraction,
performs a static check for arity errors on the program in the
definitions window.

No-Brainer operates on any sequence of top-level definitions, but
makes a weak soundness claim ONLY for code contained in top-level
module expressions.

No-Brainer makes the following soundness-like claim: if No-Brainer
identifies a piece of code as being erroneous, then that code (if
evaluated) will raise an exception[*].

No-Brainer makes no specific completeness-like claim. No-Brainer makes
two passes; the first to associate identifiers with arity
specifications, the second to identify arity errors.  No-Brainer will
correctly associate lambda expressions with definitions (both lexical
and top-level) when the lambda expression is directly contained by the
definition or is the only possible evaluation result of the expression
directly contained in the definition.  Any mutation of the identifier
causes No-Brainer to remove this identifier from its table (and hence
to make no claims about its applications).  No-Brainer will identify
arity errors only in applications where the function position is
directly an identifier.

To use No-Brainer, simply click the "No Brain" button.  No-Brainer
will print a series of errors detected, and will finish by displaying
"all done."  All output is confined to a window entitled "Here's
what's wrong with your stupid program."  Users are encouraged not to
be insulted by this mildly provocative and preliminary window title.

The user's interface to no-brainer is currently primitive, in that it
does not give a true source pointer.  This is a local problem with the
interface module, however; the result of the program check includes
syntax objects which contain information about the expression's

Useful? You decide.

[*] Note that the exception may not be an arity error, but instead
an undefined/uninitialized error. This can happen because the 
precedes the definition, or because the evaluation of the definition
raised an exception.

Posted on the users mailing list.