What I'm contemplating now is writing another C program of my own but,
instead of writing it directly in C, writing the whole thing from
scratch in CWEB. I'm under the impression that this is the way one
is supposed to write literate programs with CWEB, instead of writing
the original C program all at once or in parts and then translating
into CWEB. I'll try it this way, following my nose, but I'd just like
to know from others who do things this way:
(1) how hard is it to get used to writing C programs directly in CWEB?
(2) can you describe the compositional process?
--
Ignorantly,
Allan Adler <a...@zurich.csail.mit.edu>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
Allan Adler writes:
> [...]
>
> [...]
>
> (1) how hard is it to get used to writing C programs directly in
> CWEB?
I didn't find it much harder than writing directly, however, it
depends on your programming style. For example, I'm not able to
"plan" programs with pen and paper, I just program directly. In
this case, you cannot create all chunks and comments at once because
much reordering may become necessary.
I write portions of code that are still tamable in one go (some 1000
lines), and then add all the CWEB commands and comments to it.
> (2) can you describe the compositional process?
One thing that was an important realisation to me was that you
shouldn't make use of CWEB's nesting and reordering feature very
much. Eventually, I used in only to get the main() function at the
beginning of the document. Apart from this, it's good to keep the
code in its natural order, just as the compiler sees it, because
everyone is accustomed to this.
You may make exceptions for very interesing parts of functions that
you want to explain in detail; but keep such exceptions local and
limited.
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
ICQ 264-296-646
(See http://ime.webhop.org for Jabber, MSN, etc.)