comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: conditional compilation
Date: 2000/08/03
Date: 2000-08-03T00:00:00+00:00	[thread overview]
Message-ID: <wcc8zue31f7.fsf@world.std.com> (raw)
In-Reply-To: 8ma4lf$4g8$1@news-hrz.uni-duisburg.de

sb463ba@l1-hrz.uni-duisburg.de (Georg Bauhaus) writes:

> Robert A Duff (bobduff@world.std.com) wrote:
> 
> : I don't like so-called literate programming for the same reason I don't
> : like C macros.  In order to understand the code, you have to imagine the
> : actual output of the macro preprocessor.
> 
> Agreed if literate programming  was about code, but it is
> not.  It is about English, about explaining algorithms in
> English (or your preferred human language), about not having
> to worry about the outcome of the processor because the
> processor takes care of that. Ideally, though.

Ideally, indeed!

I'm afraid we haven't quite gotten to the point where we can ignore the
code, and just pay attention to the English explanation of the code.
I doubt we ever will, in fact.

The other day I was reading Knuth's book about MMIX, his new RISC
version of the MIX machine code.  The book contains literate programs of
various sorts: an assembler, an interpreter, and so forth.

I found the English prose to be quite nice.  So literate programming
succeeded in that regard.

But I found the code itself to be difficult to understand, partly
because it's written in a (strange dialect of) C, and partly because
it's so heavily macro-fied, as literate programs always are.

One example: there was a piece of code containing a "break" to exit a
loop.  This piece of code was not contained in a loop.  Which loop is it
exiting, I wondered?  The only way to tell was to hand-expand the
macros.

In my opinion, loop exits should be physically contained within the loop
their exiting.  Even C has this level of error checking.  But literate
programming succeeded in defeating even this simple (and good) rule,
making the code less readable than raw C code.

> If the language has facilities to express your design the
> way you think about design, good.  Literate programming
> helpers can help with this.  I'm exaggerating, but ideally
                                   ^^^^^^^^^^^^
> you would not have to worry about the outcome of
> preprocessors, compilers, optimizers, anything.

exaggerating!  :-)

> Of course you should and Knuth, supposedly having coined
> the words "literate programming", has written one of the
> books about inputs and outcomes, and that you shoul know
> how to worry about them.

- Bob




  reply	other threads:[~2000-08-03  0:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-31  0:00 conditional compilation Matthew Woodcraft
2000-07-31  0:00 ` Marin D. Condic
2000-07-31  0:00   ` Ira D. Baxter
2000-08-01  0:00   ` Simon Brady
2000-07-31  0:00     ` Marin D. Condic
2000-08-01  0:00     ` Ted Dennison
2000-08-01  0:00       ` Robert A Duff
2000-08-01  0:00         ` Laurent Guerby
2000-08-02  0:00       ` Simon Brady
2000-08-02  0:00         ` Simon Brady
2000-08-01  0:00           ` William J. Thomas
2000-08-02  0:00         ` Robert A Duff
2000-08-02  0:00           ` Georg Bauhaus
2000-08-03  0:00             ` Robert A Duff [this message]
2000-08-02  0:00           ` Brian Rogoff
2000-08-03  0:00             ` Robert A Duff
2000-08-03  0:00           ` Florian Weimer
2000-08-02  0:00         ` Georg Bauhaus
  -- strict thread matches above, loose matches on Subject: below --
2000-09-19  0:00 Conditional Compilation Kenneth Kueny
2000-09-19  0:00 ` Jeffrey Carter
2000-09-19  0:00   ` Samuel T. Harris
2000-09-20  0:44     ` Robert Dewar
2000-09-19  0:00 ` Ted Dennison
2000-09-19  0:00 ` Richard Riehle
2000-09-19  0:00 ` David Starner
2000-09-19  0:00 ` E. Robert Tisdale
2000-09-19  0:00   ` Larry Kilgallen
2000-09-19  0:00     ` Jeff Allen
2000-09-20  0:49       ` Robert Dewar
2000-09-19  0:00         ` Bobby D. Bryant
2000-09-24  0:00           ` Robert Dewar
2000-09-19  0:00   ` David Starner
2000-09-20  0:52     ` Robert Dewar
2000-09-20  0:47   ` Robert Dewar
2000-10-09  0:00   ` John McCabe
2000-09-20  1:33 ` tmoran
     [not found]   ` <8qauu3$7ei$1@nnrp1.deja.com>
2000-09-24  0:00     ` Robert Dewar
2000-09-25  2:45       ` Ted Dennison
2000-09-25  0:00         ` peter
     [not found] ` <39CA31F2.E160F0D8@res.raytheon.com>
2000-09-24  0:00   ` Robert Dewar
2001-01-02 13:27 ` Andrew Hately
2001-01-02 16:46   ` Robert Dewar
1989-12-12  0:08 conditional compilation Emery
1988-06-13  0:24 Conditional compilation Steinar Haug
1988-06-17 13:53 ` rds
1988-06-22  0:44   ` Jeff Bartlett
1988-06-23 13:01   ` Arny B. Engelson
1988-06-27 18:01     ` Dave Seward
1988-06-29 13:32   ` brucej
1988-06-17 14:48 ` rjs
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox