Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.object
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!gatech!newsfeed.pitt.edu!uunet!allegra!alice!bs
From: bs@research.att.com (Bjarne Stroustrup <9758-26353> 0112760)
Subject: Re: C++ Productivity
Message-ID: <D3ossA.EFn@research.att.com>
Organization: Info. Sci. Div., AT&T Bell Laboratories, Murray Hill, NJ
References: <D3FuGq.Kwv@da_vinci.ecte.uswc.uswest.com> <1995Feb4.210947.718@mole-end.matawan.nj.us> <3h42vv$q4h@Starbase.NeoSoft.COM>
Date: Wed, 8 Feb 1995 15:09:46 GMT
Lines: 85
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:111650 comp.lang.smalltalk:20541 comp.object:26376


dweller@Starbase.NeoSoft.COM (David Weller) wrote

 > Jeepers!  It's a good thing Ada's generics blazed the trail, eh?  
 > (Even better that Stepanov first "version" of STL was in Ada :-)

but even with the smiley and the quotes aroung ``version'' this didn't
quite square with history as I knew it. It was close enough for me to
check, though, so I forwarded Dave's full message to Alex Stepanov
(the designer of the STL) and received this reply:

 : Bjarne,
 :
 : Thank you for forwarding me the news article. As you well know, I did
 : use Ada. After all, my copy of Design and Evolution does say: "Alex
 : Stepanov knew Ada well, though, and some Ada styles may have entered
 : our thinking through his examples." In particular, I clearly recall
 : championing the importance of template functions and not just template
 : classes.
 : 
 : To set the record straight, however, I would like to point that Ada
 : Generic Library was just an adumbration of the present STL. Some
 : fundamental ideas, such as the notion of algorithmic abstraction as
 : something orthogonal and complimentary to data abstraction were
 : there. But it never achieved the desired goal - being able to express
 : algorithms in the most abstract way possible without loosing
 : efficiency. 
 : 
 : There were three main reasons for that:
 : 
 : 1) Ada requires expicit instantiations. C++ template function
 : mechanism allowed us to make the compiler to do type inference - for
 : example, associated types for iterators (value type, difference type,
 : iterator category type) are infered automatically. C++ provided me
 : with just the right balance of explicit and implicit instantiation
 : mechanisms to be able to do what I wanted. In my opinion, it takes the
 : right middle ground between Ada and ML in that respect. It still has
 : some minor flaws - I cannot say Iterator::value_type, because of the
 : inablity to put typedefs inside regular pointers, but it is the best
 : language I know for the STL-like style of programming.
 : 
 : 2) C++ memory model is much more tractible than Ada's. Ada hides
 : pointers (access types are not pointers - no pointer arithmetic). In
 : C++ it is much easier to integrate complex data strucutures and the
 : raw memory into a single framework. (See Knuth's insightful remark
 : about C and pointers in his Computer Literacy interview.)
 : 
 : 3) While C++ compilers are bad, they are not half as bad as Ada
 : compilers. I had to abandon many more advanced techiniques because the
 : compilers would do awful things - the most expensive Ada compiler for
 : PC's would go into an infinite loop and my computer would have to be
 : turned off and left there resting before it would reboot - the
 : compiler came with its own hardware! (Of course, I am talking about 86
 : to 89 time frame, things could be better now.) 
 : 
 : I would, nevertheless, be quite happy to have a go at doing STL in
 : Ada-95. It is always instructive to rewrite things: after all, I have
 : been rewriting the same code for almost two decades :-).
 : 
 : Alex

Points (1) and (2) seem fundamental.

I'm sorry if it seems that I'm taking Dave's message too serious -
especially as it contained a smiley and was in no way offensive.
However, I dislike inaccurate history.

For a fairly detailed look at the design of C++ (including where many
of the ideas where borrowed from) see:

        Bjarne Stroustrup
        The Design and Evolution of C++
        Addison Wesley, ISBN 0-201-54330-3.
        March 1994.

It contains answers to many of the questions asked about C++ in this
newsgroup - including contradictions to innumerate false assertions
about C++.

	- Bjarne





