Groups | Search | Server Info | Login | Register


Groups > comp.programming.literate > #59

Re: from pet peeves to complainants about C++ in cweb

From dtopham <dtopham@gmail.com>
Newsgroups comp.programming.literate
Subject Re: from pet peeves to complainants about C++ in cweb
Date 2012-08-21 18:02 -0400
Organization http://groups.google.com
Message-ID <k110gt$cj1$1@labrador.cs.tufts.edu> (permalink)
References <sfid-H-20120814-112110-+58.59-1@multi.osbf.lua> <k0hha2$fuu$1@labrador.cs.tufts.edu> <sfid-H-20120816-122358-+73.71-1@multi.osbf.lua> <k0j6qu$9fg$1@labrador.cs.tufts.edu> <sfid-H-20120821-180204-+139.69-1@multi.osbf.lua>

Show all headers | View raw


On Thursday, August 16, 2012 9:23:58 AM UTC-7, Aaron W. Hsu wrote:
> I use CWEB for C, not C++, so take the following comments with a grain of 
> 
> salt or two. 
> 
> 
> 
> mikolas <mikolas.janota@gmail.com> writes:
> 
> 
> 
> >1) Tool support is not great. Emacs does not give me syntax highlighting an=
> 
> >d altogether seems to be acting as a plain text editor. VI is a little bett=
> 
> >er but still, word completion's not great.
> 
> 
> 
> CWEB has a cweb mode that you can install and use. It is commented with 
> 
> some explanation of how one uses it, but fundamentally I think it is 
> 
> more of a TeX mode than a C/C++ mode. I have never been a big user of 
> 
> word completion, so I cannot comment there. I also use NEdit most of the 
> 
> time, or ed(1), and not Vi or Emacs. I have a custom set of highlightings 
> 
> that I use for CWEB + C in NEdit that works quite well. 
> 
> 
> 
> >2) Introducing "@s" directives  for every type is very annoying (I'm also n=
> 
> >ot sure how to reuse these directives between different files) .
> 
> 
> 
> I do not know how it works for C++, but most of the types declared in 
> 
> a C based CWEB document do not require @s directives. I only need @s 
> 
> directives if I refer to a type long before I typedef it or the like. 
> 
> Otherwise, my types get formatted correctly.
> 
> 
> 
> >3) Imports of the form "using bar::foo" are not typeset correctly.
> 
> 
> 
> You may be able to use @s or another control code to set how you 
> 
> want those forms typeset. 
> 
> 
> 
> >5) I'm quite unclear on how one goes about bundling up a bigger project. I'=
> 
> >m putting each clause in a different ".w" file and eventually I will end up=
> 
> > with a bunch of documents with no inter-linkage.
> 
> 
> 
> Most of the time I stick to putting most things into a single file. But 
> 
> this is C code. For example, usually, I have a one executable/shared library 
> 
> per file organization. You can use the @i code to break these out into 
> 
> separate pieces if you find that having the one large file difficult to 
> 
> navigate, though I find bookmarks or other jump points, and the PDF 
> 
> enough to manage that.
> 
> 
> 
> You may also want to look at the @( code, which allows sending to 
> 
> multiple files. I usually use it only for auxiliary files like header 
> 
> files, and not main files, but you may find it suitable for auxiliary 
> 
> class files or the like. 
> 
> 
> 
> You can also use some TeX macro hackery to take files that would normally 
> 
> weave into separate documents and combine them together into a single 
> 
> document, once you understand the TeX output by CWEB. I've not needed to 
> 
> do this before, but I am sure that it can be done.
> 
> 
> 
> >6) A meta-complaint. The lack of proper support makes me very suspicious ab=
> 
> >out the number of people using the tools/approach.
> 
> 
> 
> I suspect that most literate programming tools do not see nearly the use 
> 
> of something like, say, JavaDocs, but you're also assuming that most people 
> 
> would want "tool support" in the way you are talking. CWEB is a mostly 
> 
> frozen program (like TeX), barring large and unforeseen bugs. However, it 
> 
> is quite stable and usable. I use it in conjunction with my own ChezWEB on 
> 
> mostly all my projects. It's a good tool, but it's design and its users 
> 
> are likely more text editor hacker types; I know I am. I don't use large 
> 
> IDEs most of the time, or extra features like word completion (though 
> 
> I sometimes use some other macros to call up man pages or something 
> 
> equivalent). 
> 
> 
> 
> Knuth's own workflow is, I believe, an Emacs buffer in cweb.el mode, so 
> 
> at least that is somewhat how the system was designed, but that is also 
> 
> for a C workflow. I don't know how good CWEB is at handling C++ features. 
> 
> You can checkout the Stanford GraphBase for an example of a set of multiple 
> 
> files that correspond to multiple features in C. I am not aware of a good 
> 
> example of CWEB use in C++; maybe someone else can recommend something?
> 
> 
> 
> -- 
> 
> Aaron W. Hsu | arcfide@sacrideo.us | http://www.sacrideo.us
> 
> Programming is just another word for the lost art of thinking.

You may wish to try nuweb; it is easy to compile on any platform being distributed in source code and only requiring a single C program to use.
I think it is effective for C++. Take a look at this excellent example:
http://www.cs.rpi.edu/~musser/gp/literate.html

-Dave

Back to comp.programming.literate | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

from pet peeves to complainants about C++ in cweb mikolas <mikolas.janota@gmail.com> - 2012-08-15 21:10 -0400
  Re: from pet peeves to complainants about C++ in cweb "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-08-16 12:23 -0400
    Re: from pet peeves to complainants about C++ in cweb dtopham <dtopham@gmail.com> - 2012-08-21 18:02 -0400
      Re: from pet peeves to complainants about C++ in cweb Simon Wright <simon@pushface.org> - 2012-08-22 06:07 -0400
      Re: from pet peeves to complainants about C++ in cweb "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-08-22 16:37 -0400
        Re: from pet peeves to complainants about C++ in cweb Simon Wright <simon@pushface.org> - 2012-08-22 17:22 -0400
          Re: from pet peeves to complainants about C++ in cweb "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-08-23 14:27 -0400
        Re: from pet peeves to complainants about C++ in cweb dtopham <dtopham@gmail.com> - 2012-08-23 00:07 -0400
          Re: from pet peeves to complainants about C++ in cweb "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-08-23 14:27 -0400

csiph-web