From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 7 Dec 92 19:40:59 GMT From: mcsun!sunic!news.lth.se!dag@uunet.uu.net (Dag Bruck) Subject: Re: C++ vs. Ada -- Is Ada loosing? Message-ID: <1992Dec7.194059.9171@lth.se> List-Id: In srheintze@happy.colorado.edu writes: > >HOWEVER, please read "A dynamic Vector is harder than it looks" from the June >1992 is issue of JOOP (Journal of Object Oriented Programming) - vol 5 no 4. >*THIS ARTICLE IS SCARY* Basically Tom Cargill pointed out a bug that nearly >all C++ textbooks have made when they implement a dynamically sized array. >This includes the textbook written by the implementor of the AT&T Cfront >compiler (will I get in trouble if I mention his name?). If the language is s o >convoluted that even the experts (including the compiler writers) cannot get >their simple textbook examples correct, then I conclude there is something >drastically wrong with the language. I agree that Tom Cargill wrote an interesting article, but I think the conclusion is exactly what Cargill writes: a dynamic vector class is harder than it looks. People sometimes fall into the trap of thinking that hard problems are easier to solve with a "stricter" programming language. This is often not the case. It is particularly difficult to realize a library that is natural to use, and at the same time efficient with regard to space and time. A matrix library is a good example: - a trivial matrix library is not hard to write - it becomes much harder if you want to implement a full set of natural operations, e.g., slices - it becomes harder if you want to provide automatic memory management - it becomes *much* harder if you want to provide "optimal" memory management that immediately reuses space for used temporaries. [Optimal space utilization is for example to use only one temporary variable to calculate the matrix expression "X := A+B+C".] Dag Bruck