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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,effb80d4bb7716dd X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Wanted: Ada STL. Reward: Ada's Future Date: 1999/02/04 Message-ID: #1/1 X-Deja-AN: 440665030 References: <790f4q$3l@bgtnsc01.worldnet.att.net> <36B856E4.D921C1D@bton.ac.uk> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 918150677 16679 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-04T00:00:00+00:00 List-Id: On Thu, 4 Feb 1999, Ehud Lamm wrote: > On Wed, 3 Feb 1999, John English wrote: > > > IMHO performance is not the problem for implementing the STL in Ada. > [snip] > > This makes it hard to support arrays as "just another > > collection type" in the way that the STL does, so you can't easily > > define algorithms which can be applied impartially to arrays or > > vectors or maps or whatever. There is an obvious way to do it, and that is simply to define the array iterator as a record with a pointer to an array and an index. This may not satisfy John's definition of "easily", but it shows that it can be done. Incidentally, the language Ness which was a part of the Andrew Toolkit had as a basic data type the "subsequence reference", which consists of a pointer to a string and two indices (lo and hi, say) and uses these instead of strings. Many basic string algorithms are expressed elegantly in terms of operations on subsequences. Nice stuff, and easily implemented in Ada. See http://www.cs.cmu.edu/~wjh/papers/subseq.html > So if understand you correctly, you are also of the opinion that a simple > port of STL may be problematic. But - the problems are not performance. > Ok. > > By the way, there is an interesting cultural/memetic phenomena here. I > raise it since it seems that Ada fans are interested in the marketplace of > ideas ("future"/"java" threads etc.). > > If I understood the original question on this thred - it was about SOME > libray LIKE the C++ STL for Ada. Supplying things like sets and lists. We > started by dicussing which of these featurees are really needed, but soon > slipped to discussing proting the STL. We somehow missed the obvious > question which is "Can we do something better or functionally equivalent, > but different - in Ada." By necessity, a port of the STL to Ada will be different. C++ templates and Ada generics are quite different, the overloading schemes are different, etc., etc. In that the STL is sometimes used to effect a functional style of programming in C++, I think Ada will look better since Ada generics take subprogram parameters, Ada has nested subprograms, etc., etc., C++ provides more syntactic sugar, allowing the overloading of array indexing amongst others, so there is a seamlessness to the STL that probably won't be achieved in a "pure Ada" translation. What troubles me about this discussion is the notion that anything that is done in C++ is anathema to Ada. There is a C++ Booch Component Library, so therefore the Booch Components are the wrong model for any Ada library. > This, to my mind, show that STL won the day. It is strange, since it is > one of the more complex libraries I saw, and most C++ programmers are > either afraid of using it - or simply don't know how. It's actually a fairly simple library, the problem is that many C++ compilers still don't handle the C++ template system in its glory (;-)) so that many C++ programmers probably stick to a simple subset of the language. I expect that will change as C++ compilers mature, and the STL becomes more popular. -- Brian