[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: meta-comment on typing

Michael Sperber wrote:
I personally have no objection to type declaration, but disagree that
the code becomes more readable.  In fact, I've seen plenty of evidence
that the exact opposite is the case, both in the C world (with type
declarations) and in the R5RS/CL world (without).

Type declarations, especially of procedure parameters, is an essential
part of the documentation and specification of a procedure.  As a
compact, easily-understood, machine-checkable specifiction that as
a side benefit (often) improves performance it seems a no-brainer.

The R5RS pervasively uses type declarations, in the form of
conventions for variable names.

I agree that for short functions adding type declarations make the
code longer and hence harder to read - but the key issue is whether
it makes the code easier to understand.  I'm convinced it usually does.

Some anecdotal evidence can be found in the paper by Egner et al.
> cited at the bottom of the SRFI.

I found the paper, but no anectodal evidence about type declarations.
Rather the opposite: The unexpectedly slow behavior mentioned in some
programs due to decimal points wouldn't have happened if they had
used type declarations.
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/