[Aldor-l] Literate programming

pip88nl at gmail.com pip88nl at gmail.com
Wed Aug 20 14:04:00 EDT 2008


On Tue, Aug 19, 2008 at 11:06:21PM +0200, Ralf Hemmecke wrote:
>  >> If that is the case, it would be an
> >> excellent alternative to the C preprocessor, because the latter kills any
> >> useful line information.
> 
> I don't think I understand what the C preprocessor kills.

Consider the code:

  #define MACRO(arg1, arg2)       \
    line1 with arg1;              \
    line2 with arg1;              \
    line3 with arg2

now if you use it:

  MACRO (hello, world);

it is expanded to:

  line1 with hello; line2 with hello; line3 with world;

Also, what is used a lot in aldor code is:

  #define DEBUG(statement)  if (debug) { statement; }

and then:

  DEBUG ({
     line1;
     line2;
     line3;
  })

which is expanded to:

  if (debug) { line1; line2; line3;; }

that's what I mean.

Pippijn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.aldor.org/pipermail/aldor-l_aldor.org/attachments/20080820/f744f557/attachment-0002.bin>


More information about the Aldor-l mailing list