From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-11 17:11:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!ppp-1-176.cvx1.telinco.NET!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Literate Programming [was: A case where ...] Date: Fri, 11 Jan 2002 20:26:45 -0000 Message-ID: References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> <5ee5b646.0201040829.18db8001@posting.google.com> <3C35E733.6030603@mail.com> <3C35FE2A.9020802@mail.com> <3C3C1438.FBF10FC3@baesystems.com> <3C3EB43E.B82E92CA@baesystems.com> NNTP-Posting-Host: ppp-1-176.cvx1.telinco.net (212.1.136.176) X-Trace: fu-berlin.de 1010797916 29866095 212.1.136.176 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:18803 Date: 2002-01-11T20:26:45+00:00 List-Id: What I think just be might be a worthwhile feature to add to a future revision would be some kind of line-oriented Ada 'on/off switch'. This is best explained by an example. Suppose the (new) standard defined a line in source code, which contained just two lexemes, the first === and the second an identifier, as being a (say) 'mode switch'. If the identifier is ADA (ignoring case), the following text lines are parsed as Ada source code, up to the next mode switch or the end of the file. If the identifier is anything else, the following text lines are ignored, up to the next mode switch or the end of the file. A file could then contain e.g. [begin snippet] === docbook The next function returns the opposite direction to the one given as its parameter. === ada function Opposite (Way: in Direction) return Direction; === docbook The next function ... [end snippet] This would mean that normal text files could be used to contain mixed content, including Ada source code, and yet any standard Ada compiler could directly compile such files. This would be a huge advantage over having to pre-process ('tangle') the files before compiling them, which tends to render the automatic 'make' tools supplied with Ada systems useless. For the unfamiliar, the essence of 'literate programming' (invented by the heroic Prof. Don Knuth) is to combine software documentation, in its own suitable markup language (e.g. TeX or DocBook), with the source code itself, in the same source file. This simply means you can neatly update both source code and documentation at the same place, in the same file, at the same time. In the above example, with DocBook combined with Ada, the file would be pre-processed ('weaved') to produce pure DocBook, which would then be processed to be rendered on the screen (e.g. in a web browser) or formatted and printed. This pre-processing could be obviated by making the mode switches something like "". It would be advantageous for the switches to be defined by the standard, so that all Ada compilers would recognize them. It would be a splendid opportunity to add a great buzzword to Ada: we could say it was a "literate programming language". Gotta help with advocacy! -- Best, Nick Roberts