3 ms·
Second the Ada note. That language is so well constructed and thought out on many levels. ...except the outer, most superficial level. I'm genuinely afraid tha
by kqr 9y ago
Second the Ada note. That language is so well constructed and thought out on many levels.
...except the outer, most superficial level. I'm genuinely afraid that it will never "catch on" because it just looks weird. (But not weird enough to attract that kind of people.)
It's a shame because
- Ada generic packages are exactly what C++ templates should have been
- Derived types and record extension is inheritance that makes sense
- Access types are obvious in hindsight
- Correct terminology for procedures and functions does help a lot in communication
- RAII in the shape of controlled types feels a bit bolted on but it works very well
- Named blocks and explicit closing is easy but very useful
- Class-wide types are deemphasized the way polymorphism should be
- The -gnatyy flag is almost as good as gofmt.
- Tasks and protected types form a very intuitive and safe concurrency mechanism
- Having contract-based programming as an option built into the language is way superior to relying on asserts in the procedure
- While not always budgeted for, when there is time to spend, SPARK is uh-mazing. Strong guarantees at relatively low cost, and reasonably easy to learn as well.
- pjmlp 9y agoAnd the STL first implementation was actually done in Ada. :)
- AnimalMuppet 9y agoYes and no. Yes, Stepanov's first attempt at writing something like the STL was done in Ada. But no, it wasn't "the STL" - it was neither Standard nor Template. And Stepanov abandoned Ada for C++, because Ada wasn't expressive enough for what Stepanov was trying to write.
- pjmlp 9y agoMeaning if Stepanov had not played with Ada for its first implementation, followed by Bjarne advocating him to use C++ instead, the STL would never happened in its form. And yes, it wasn't quite the STL, we had quite a few variations of it, the most well known coming from SGI, until things kind of settled at ANSI.
- AnimalMuppet 9y agoI disagree. Stepanov wanted to write that kind of software. He would have done it in any vehicle he found suitable. If he hadn't started with Ada, he still would have wound up writing it in some language. And C++ was among the better candidates for the language to use. It was more suitable than Ada. And, do you have any basis for the statement that Stroustrup advocated C++ to Stepanov?
- pjmlp 9y agoFrom the source itself, "And, of course, Andy and Bjarne Stroustrup are responsible for putting STL into the standard." "The support of Bjarne Stroustrup was crucial. Bjarne really wanted STL in the standard and if Bjarne wants something, he gets it. He is as stubborn as a mule. He even forced me to make changes in STL that I would never make for anybody else - I am also stubborn, but he is the most single minded person I know. He gets things done. It took him a while to understand what STL was all about, but when he did, he was prepared to push it through. He also contributed to STL by standing up for the view that more than one way of programming was valid - against no end of flak and hype for more than a decade, and pursuing a combination of flexibility, efficiency, overloading, and type-safety in templates that made STL possible. I would like to state quite clearly that Bjarne is the preeminent language designer of my generation." http://www.stlport.org/resources/StepanovUSA.html http://www.stlport.org/resources/StepanovUSA.html
- AnimalMuppet 9y agoThat says that, once Stepanov had written the STL in C++, Stroutrup advocated the STL becoming part of the C++ standard. But you said, > Bjarne advocating him to use C++ instead [of Ada] which your quote here doesn't substantiate at all.
- pjmlp 9y agoI got the names mixed up, it was Andrew Koenig not Bjarne. "My attempts to implement algorithms that work on any sequential structure (both lists and arrays) failed because of the state of Ada compilers at the time." "In 1987 at Bell Labs Andy Koenig taught me the semantics of C. The abstract machine behind C was a revelation. I also read lots of UNIX and Plan 9 code: Ken Thompson’s and Rob Pike’s programming style certainly influenced STL. In any case, in 1987 C++ was not ready for STL and I had to move on. " "In 1993, after 5 years working on unrelated projects, I returned to generic programming. Andy Koenig suggested that I write a proposal for including my library into the C++ standard, Bjarne Stroustrup enthusiastically endorsed the proposal and in less than a year STL was accepted into the standard. STL is the result of 20 years of thinking but of less than 2 years of funding." http://stepanovpapers.com/history%20of%20STL.pdf http://stepanovpapers.com/history%20of%20STL.pdf
- mamcx 9y agoI have done pascal before and I wish to have ADA more easily available.
- narimiran 9y ago> I have done pascal before and I wish to have ADA more easily available Then you might be interested in https://nim-lang.org/ https://nim-lang.org/ as a Pascal-like Rust alternative.
- kqr 9y agoThere is a free and open Ada implementation these days: GNAT, the GNU Ada Translator, is a full and complete implementation of Ada.
- mattgreenrocks 9y agoThanks for the rundown. Sounds like Ada has a lot of good ideas to steal!
- kqr 9y agoDefinitely! My C coding improved vastly after spending some time with Ada. Though it's worth keeping in mind that it's not only about each individual thing being good – it's also that they work really well together.
- goldfire 9y agoThe thing that kept me from trying Ada (back a couple of years ago when I was writing firmware and so was kind of on its home turf) was a lack of good resources for learning it. I got a copy of the book "Programming in Ada" by Barnes, and did not find it very helpful. Often the advice seems to be to go read the Reference Manual, which I agree is highly readable for a language standard, but it's not aimed at users of the language. If anyone here has any other resources to recommend, I'd be happy to hear about them.
- kqr 9y ago> it's not aimed at users of the language. Is it not? It doesnt contain recipes, no, but it fully documents the fundanental units of the language youll express your solution in.