Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

literary programming and C++

9 views
Skip to first unread message

Anssi Porttikivi

unread,
Mar 15, 1994, 12:41:56 PM3/15/94
to
Dear people!

THE BACKGROUND

I have read the TeXbook and the LaTeX book through with
medium concentration. I have used TeX a little. I
tried to read "TeX - The Program" but it was too much
for me.

I have a copy of the original Knuth WEB report and have
glanced through it.

But I never had any real use for these methods before.
Now we are considering CWEB for a middle sized four
people programming project at The Helsinki University,
Department of Computer Science. Our department uses
LaTeX a lot but has very little experience with WEB.

I have spent two days reading the LitProg stuff in WWW
- an excellent proof of the tremendous effectiveness of
Internet technologies of today as learning tools.

THE PROBLEM

However, I maybe stupid but I don't quite understand
how to write a makefile and WEB source files to produce

- a single document with single contents and index page
- lots of C++ header and implementation files

Maybe this is trivial and is done with CWEB
@(object.H@> and @(object.C@> commands? How about
multiple WEB source files?

We are using all kinds of weird C++ features
extensively, I don't think that could be a problem?

And I am not sure if I am in the right track at all.
And what do you think, should I complicate this even
further by introducing SCCS to the project?

Good grief, tell me what is the fastest way for humble
humans to write best possible code! With "best" I mean

a) understandable
b) re-usable
c) with fool proof easy to use user interface
d) reliable

I don't give a damn about memory requirements or speed!

I believe in systems simple enough to be obviously
right, not in systems complex enough not to be
obviously wrong.

Why am I posting this anyway? I should be reading the
docs and examples instead... And the whole project
(program visualization, concentrating on string
algorithms) should maybe be done in Visual Basic if we
wanted to get it done fast...

Anssi.Po...@Helsinki.Fi

ASti...@maths.exeter.ac.uk

unread,
Mar 16, 1994, 5:50:44 AM3/16/94
to

> C++ ist another question. ...
> I absolutely discourage anybody to use such a language
> for any software projects. ...
> The semantics of C++ constructs is also extremly large.

This remark is a bit out of scope of this discussion group. Let me,
nevertheless, comment on it.

My experiences with C++ on a project of medium size have been very
encouraging. I am using only a small subset of the language, and I am
using it conservatively, orientating myself with Stroustrup's "The C++
Programming Language".

The two features that are most important to me are
* the possibility of bundling functions and data together and
* operator overloading.

In fact, the latter point alone would justify my using C++. Being in
the business of computer assisted mathematical proof, I want my code
to be as close to mathematical notation as possible.

But I agree that the language is huge; it must be a nightmare to
write a C++ compiler.

Back to Anssi's question: I have been using C++ together with FWEB for
about one year, and I am pleased with the results. Recently I
switched to NOWEB, which I prefer to FWEB, mainly because of the ease
with which it fits into the UNIX toolbox. I also find its syntax
more flexible.

My advice would be: Keep using C++, and use it together with NOWEB.

Andreas Stirnemann.
ASti...@maths.ex.ac.uk

Eric Ogata

unread,
Mar 16, 1994, 3:14:56 PM3/16/94
to
In article <CARROLL.94...@stimpy.eecis.udel.edu>
car...@stimpy.eecis.udel.edu (Mark C. Carroll) writes:

> Ada9X (free compiler from GNU)

Ok, where can I find this? I just checked prep.ai.mit.edu. If it is
there it is not named in a manner such that I can figure out what it
is (gnada, gnu-ada, ada9X...) I have seen no anouncement of its
availability. Does it in fact exist? Has 9X with OOP extensions
actually been formally accepted yet? Commercial Ada compilers are
*way* too expensive for this Navy employee.
--
eric
og...@tethys.nswc.navy.mil

Zdenek Wagner

unread,
Mar 16, 1994, 4:04:38 PM3/16/94
to
On Wed, 16 Mar 94 13:58:56 EST Lee Wittenberg said:
>Thomas Herter writes:
>
>> I believe that nodoby seeking for beauty and correctness of
>> algorithms should use language like C++. And since the langauge
>> is still ``under construction'' better wait for the final product.
>
>I don't want to get involved in a ``language war,'' but Stroustrup has
>a new book out entitled _The_Design_and_Evolution_of_C++_ (Addison-Wesley,
>1994) that discusses the various design decisions and the reasons for each
>of them. It's worthwhile reading for both friends and foes of C++,
>and (IMHO) should be required reading for all language designers (as
>it's the only book I've seen that describes all the pitfalls of
>programming language design).
>
> -- Lee
>
>------------------------------------------------------------------------
>Lee Wittenberg | More good code has been written in
>Computer Science Department | languages denounced as ``bad'' than in
>Kean College of New Jersey | languages proclaimed ``wonderful'' --
>Union, NJ 07083 | much more.
>USA |
> | -- Bjarne Stroustrup
>le...@pilot.njin.net | "The Design and Evolution of C++" (1994)
>------------------------------------------------------------------------

Anyway, if we wait until the perfect programming language is developed and
it is a final product, we will find that we are too old (or possibly even
dead). Isn't it better to make a reasonable compromise?

,~~~/ /` / /| /~~~
/ / |_/ /__/ ' | /
/ /~~/ /~~/ /~~/ /~~/ /\ | /| / /~~/ /~~/ /~~/ /~~/ /~~~
/ , / / /~~~ / / /~~~ / \ |/ |/ / /_/ / / / /~~~ /
~~~~ ~~~ ~~~ ' ' ~~~ ' ` ' ' ~~~ ~~/ ' ' ~~~ '
Zdenek Wagner______/

Some gateway between me and you may garble backslash. It will appear
on your screen as ã due to problems with EBCDIC <--> ASCII conversion.
It has already been corrected on SOME gateways.

The domain `.cs' does no longer exist and was replaced by `.cz'.
Valid addresses are: <wag...@csearn.bitnet>
<wag...@earn.cvut.cz>
^^

Thomas Herter

unread,
Mar 17, 1994, 3:26:05 AM3/17/94
to
> Ok, where can I find this? I just checked prep.ai.mit.edu. If it is
> there it is not named in a manner such that I can figure out what it
> is (gnada, gnu-ada, ada9X...) I have seen no anouncement of its
> availability. Does it in fact exist? Has 9X with OOP extensions
> actually been formally accepted yet? Commercial Ada compilers are
> *way* too expensive for this Navy employee.
> --
> eric
> og...@tethys.nswc.navy.mil

Try `gnats' -- Gnu Ada Translation System

Thomas

------------------------------------
Thomas Herter, SNI Muenchen (thomas...@mch.sni.de) tel +89 636 49973

Glenn Vanderburg

unread,
Mar 17, 1994, 10:32:31 AM3/17/94
to
In article <CMM-RU.1.4.7...@pilot.njin.net>,
Lee Wittenberg <le...@pilot.njin.net> wrote:
>``Premature optimization is the root of all evil.''
> -- Knuth

Just FYI ... after giving Knuth credit for this for years, I recently
saw a place where Knuth attributes it to C.A.R. Hoare. From ``The
Errors of TeX,'' on page 276 of _Literate_Programming_:

"But I also knew, and forgot, Hoare's dictum that premature
optimization is the root of all evil in programming."

Does anybody know where this statement first appeared?

---Glenn
(crossposted to alt.quotations)

David Kastrup

unread,
Mar 17, 1994, 10:46:41 AM3/17/94
to
og...@tethys.nswc.navy.mil (Eric Ogata) writes:

>> Ada9X (free compiler from GNU)

> Ok, where can I find this? I just checked prep.ai.mit.edu. If it is
>there it is not named in a manner such that I can figure out what it
>is (gnada, gnu-ada, ada9X...)

gnada is close. The thing is called gnat, but don't ask me why. Don't
ask me how good it is currently, or at all, as I never looked into it.
--
David Kastrup d...@pool.informatik.rwth-aachen.de
Tel: +49-241-72419 Fax: +49-241-79502
Goethestr. 20, D-52064 Aachen

Mark C. Carroll

unread,
Mar 17, 1994, 10:50:46 AM3/17/94
to
>>>>> "Eric" == Eric Ogata <og...@tethys.nswc.navy.mil> writes:
In article <OGATA.94M...@tethys.nswc.navy.mil> og...@tethys.nswc.navy.mil (Eric Ogata) writes:


Eric> In article <CARROLL.94...@stimpy.eecis.udel.edu>


Eric> car...@stimpy.eecis.udel.edu (Mark C. Carroll) writes:

>> Ada9X (free compiler from GNU)

Eric> Ok, where can I find this? I just checked prep.ai.mit.edu. If
Eric> it is there it is not named in a manner such that I can figure
Eric> out what it is (gnada, gnu-ada, ada9X...) I have seen no
Eric> anouncement of its availability. Does it in fact exist? Has 9X
Eric> with OOP extensions actually been formally accepted yet?
Eric> Commercial Ada compilers are *way* too expensive for this Navy
Eric> employee. -- eric og...@tethys.nswc.navy.mil

The GNU Ada compiler is called GNAT. The current version is available
from cs.nyu.edu. I haven't had the opportunity to do much with it
recently, but the authors claim to have implemented most of the 9x
spec. Tagged types are definitely working.

(BTW, sorry about the misleading title change. I was originally taking
a detour in my earlier message, which I decided to defer to another
message, and I forgot the change the title back.)

<MC>

--

Eric Ogata

unread,
Mar 17, 1994, 12:12:06 PM3/17/94
to
In article <CARROLL.94...@stimpy.eecis.udel.edu>

car...@stimpy.eecis.udel.edu (Mark C. Carroll) writes:

The GNU Ada compiler is called GNAT. The current version is available
from cs.nyu.edu. I haven't had the opportunity to do much with it
recently, but the authors claim to have implemented most of the 9x
spec. Tagged types are definitely working.

Thanks to all those who pointed me at this. I am taking a look at it.
Hoping to find a *good* OOP environment. Ada is not one of the first
places I would have looked but perhaps 9x has fixed that? c++ is
definitely getting on my nerves lately. Operator overloading in c++
particularly seems *extremely* inflexible and baroque. If this is
supposed to be one of c++' *good* features, I am a little worried.
Too bad our management is too narrow minded to consider real options
such as CLOS or Smalltalk... Oh yeah, this is the literate programming
group... seems to be flooded with inappropriate post lately, such as
mine... sorry, won't happen again:)
--
eric
og...@tethys.nswc.navy.mil

Mark C. Carroll

unread,
Mar 17, 1994, 1:21:18 PM3/17/94
to

>>>>> "David" == David Kastrup <d...@hathi.informatik.rwth-aachen.de> writes:
In article <2m9u11$1...@urmel.informatik.rwth-aachen.de> d...@hathi.informatik.rwth-aachen.de (David Kastrup) writes:


David> og...@tethys.nswc.navy.mil (Eric Ogata) writes:
>> In article <CARROLL.94...@stimpy.eecis.udel.edu>
>> car...@stimpy.eecis.udel.edu (Mark C. Carroll) writes:

>>> Ada9X (free compiler from GNU)

David> gnada is close. The thing is called gnat, but don't ask me
David> why. Don't ask me how good it is currently, or at all, as I
David> never looked into it. -- David Kastrup

GNAT = GNU/NYU Ada Translator.

<MC>
--

Lee Wittenberg

unread,
Mar 17, 1994, 3:07:44 PM3/17/94
to
Glenn V. writes:

> >``Premature optimization is the root of all evil.''
> > -- Knuth
>
> Just FYI ... after giving Knuth credit for this for years, I recently
> saw a place where Knuth attributes it to C.A.R. Hoare. From ``The
> Errors of TeX,'' on page 276 of _Literate_Programming_:
>
> "But I also knew, and forgot, Hoare's dictum that premature
> optimization is the root of all evil in programming."
>
> Does anybody know where this statement first appeared?

I first saw this statement in Knuth's article on using goto's (somwhat
of a response to Dijkstra's famous ``Goto statement considered
harmful''). I forget the exact title, the the article is reprinted in
his recent _Literate_Programming_ book, and he states it without
attribution. On the other hand, ``The Errors of TeX'' is also in
_Literate_Programming_, so who knows? We could ask William Safire
(explanation for our non-American cousins: Safire is a ``language
maven'' in the US), but I don't think he's really interested in CS.

-- Lee

------------------------------------------------------------------------
Lee Wittenberg |
Computer Science Department | But the age of chivalry is gone; that of
Kean College of New Jersey | sophisters, economists, and calculators
Union, NJ 07083 | has succeeded ...
USA |
| -- Edmund Burke (1793)
le...@pilot.njin.net |
------------------------------------------------------------------------

Norman Ramsey

unread,
Mar 18, 1994, 1:35:34 PM3/18/94
to
In article <OGATA.94M...@tethys.nswc.navy.mil>,

Eric Ogata <og...@tethys.nswc.navy.mil> wrote:
>Hoping to find a *good* OOP environment. Ada is not one of the first
>places I would have looked but perhaps 9x has fixed that? c++ is
>definitely getting on my nerves...

This discussion wouldn't be complete without mentioning Modula-3.
I had worked in Ada for 2 years before seeing Modula-3, and one of the
things that struck me is that they did everything that Ada set out to
do, only more cleanly. Modula-3 has an easily understandable object
model based on single inheritance.

To learn more, see Greg Nelson's book, `Systems Programming with Modula-3'

I have directed followups to comp.lang.modula3


Norman Ramsey

ASti...@maths.exeter.ac.uk

unread,
Mar 21, 1994, 7:28:05 AM3/21/94
to

> This isn't to say that C++ isn't the best choice for your project - it
> very well may be. But you've not presented an argument to support
> that.

It was not my intention to argue that C++ was the BEST choice for my
project, only that it is not in all circumstances a bad language.
Supposing, however, that I want to use the very best language for my
next project, what should I choose, given the following list of
requirements:

* Efficiency is important. So it should be a compiled language.

* The compiler must be free.

* It must be easy to install (in, say, one day).

* The compiler (and, of course, the compiled programs) must run under
UNIX (SunOS and SiliconGraphics IRIX)

* I want to be able to package code and data together and use
more than one instance of the resulting class. (The latter point
probably rules out languages such as Modula 2.)

* Operator overloading. I want use the standard arithmetic operators
(+,-,*,/) for my objects (e.g. vectors, matrices).
Moreover, I like to overload the function call operator "()" for
expressing either evaluation of (mathematical) analytic functions
or composition of analytic functions. Example:

function f, g;
complex z;
function h = f(g); // h is going to be the composition of f and g
complex w = f(z); // w will be the value of f at the point z

* I need to interact with the floating point hardware (in order to set
the rounding mode).

* I need dynamical storage allocation.

* I occasionally need standard mathematical functions like log, sin, sqrt.

* I need good input/output facilities.

* I want to be able to pass command line arguments to my programs.

Virtual functions (object oriented programming in the strict sense), are
not indispensable for me, but nice to have.

I'll be grateful for any advice.

Andreas Stirnemann.
ASti...@maths.ex.ac.uk


0 new messages