Re: Theories on why Lisp source *seems* to have less comments?
- From: "Steven E. Harris" <seh@xxxxxxxxx>
- Date: Fri, 21 Jul 2006 21:31:56 -0700
Tim X <timx@xxxxxxxxxxxxxxx> writes:
How often do you see something like
x = 10 // set x to 10
Maybe slightly exaggerated, but you get the idea.
One idiom I've seen a lot of in C and C++ -- typical of less mature
programmers -- is the function "plan" left in comment form. The
programmer starts off facing a daunting task by writing a series of
imperative steps as comments:
// Open the file.
// Read each line.
// Does this line start with "cheese"?
// Yes! Let's now try to read what kind of cheese...
// ...
// Close the file.
// Return the result.
The programmer starts filling in code for these steps, usually amidst
the same burgeoning function, and leaves the comments in place --
partly because the smaller steps have not been bundled up in helper
functions. The comments serve as headings to break up the 500-line
mess. It's also frightening to note how often these commented steps go
unimplemented, such as the error cases.
This kind of writing process doesn't work well in Lisp. Perhaps the
initial laying out of steps could be useful, but the code won't settle
in and among the comments as easily. A Lisp author is more likely to
go and create the smaller helper functions, and is more likely to
chain function calls and return values, with the expression tree
growing deeper before it grows wider. The comments get squeezed out,
as they should.
--
Steven E. Harris
.
- References:
- Theories on why Lisp source *seems* to have less comments?
- From: Jonathon McKitrick
- Re: Theories on why Lisp source *seems* to have less comments?
- From: Tim X
- Theories on why Lisp source *seems* to have less comments?
- Prev by Date: Re: Theories on why Lisp source *seems* to have less comments?
- Next by Date: Re: asdf unload-op ??
- Previous by thread: Re: Theories on why Lisp source *seems* to have less comments?
- Next by thread: Re: Theories on why Lisp source *seems* to have less comments?
- Index(es):
Relevant Pages
|