9 ms·
Ada is not just another programming language (1986)
- tombert 5y agoAda is a language that has been on my "todo list" of languages for awhile (just after FORTH). I generally hate this term, but Ada does kind of look like a language that was "ahead of its time", specifically in regards to concurrency.
- adrian_b 5y agoWhile studying how concurrency is done in Ada is certainly instructive and even today many languages and multi-threading libraries have more poor support for concurrent programming than Ada had since the beginning, a language that was really ahead of its time regarding concurrency was IBM PL/I. 15 years before Ada, in 1964, IBM PL/I had facilities for multitasking that e.g. included a wait function that could do everything that can be done with WaitForMultipleObjects / WaitForSingleObject. The POSIX threads suck because they lack such a powerful wait function and many other multi-threading libraries, e.g. the C++ standard library, are forced to offer only what is available everywhere, so they do not have anything that is missing in the POSIX threads.
- gpderetta 5y agoAny kernel based wmo is bot going to work well for fastpathed primitives. For example on windows you can't wmo for critical sections or keyed events. But you can implement an pure userspace or hibrid user/kernel wmo even on top of something like unix poll just fine, so saying that the standard lacks it because of POSIX is wrong.
- adrian_b 5y agoThe UNIX wait system call, introduced in 1970 or 1971, after porting UNIX to PDP-11, provided a subset of the features of PL/I wait, e.g. it allowed waiting until any of the children of a process terminates. So UNIX had very early some kinds of waiting for multiple events. A decade later, various other waiting functions, e.g. select and poll were introduced, for networking. I did not say anything about UNIX processes, but about the standard POSIX threads, the normal way to use multiple threads in a single process under UNIX-compatible operating systems. For example, with pthreads, you can join only a single thread. You can join all threads in an inefficient way, joining them one-by-one, but there is no way to join the first thread that happens to terminate, which is actually the most frequent thing that you want to do. You can achieve this in a convoluted and inefficient way, using various forms of communication between threads, but this is a very basic feature that should have existed in the standard. Taking into account that various methods of waiting for multiple events had existed for decades in UNIX, it is even more baffling that this was omitted in the POSIX threads standard. Like I have said, this has also constrained the later standards, e.g. the C++ standard.
- bodhiandphysics 5y agoWait doesn’t wait on multiple objects. It just check the process table to see if any children have exited. If they haven’t it waits for a signal... any signal! It also sets a handler for sigchild. Unix in general can’t do the same for and arbitrary object because a) it requires that the waitable only signal a single thing, and b) there are only a small number of signals! So wait is a little special. Generally wait on multiple objects requires a general system to handle asynchronous ipc, which Unix doesn’t have (unlike say windows). Also if you want to wait on multiple events, use a semaphore!
- Cloudef 5y agoI like how in ada you can specify custom range integers
- wk_end 5y agoI've always wondered - does Ada track or enforce these ranges? Like, if I have a variable `i` in range 0...10 and write the Ada equivalent of `i++`, does Ada know that from there on out `i` is in range 1...11? Something like TypeScript's type narrowing?
- Cloudef 5y agoYes, it's enforced by any _runtime_ operation. See: https://www.adaic.org/resources/add_content/standards/05rm/html/RM-3-5-4.html https://www.adaic.org/resources/add_content/standards/05rm/h...
- Jtsummers 5y agoThe range wouldn’t change in Ada. The type for a variable is fixed at compile time. It will ensure (at runtime and partially at compile time) that the value doesn’t go outside the range, though.
- throwaway81523 5y agoUsually with runtime checks, but it can also in some situations be done statically, such as with SPARK.
- tasty_freeze 5y agoPascal had subrange types before Ada, not only for integers but characters too. var day : 1 .. 31; letter : 'A' .. 'Z'; And you could specify ranges on array subscripts as well: var weight : array[-5 .. 5] of integer;
- Cloudef 5y agoAh yes, it's been a while since I've touched pascal.. Good times
- transfire 5y agoAda is just another programming language.
- adrian_b 5y agoTrue, but nevertheless Ada is an important language in the history of programming languages. After 1970, there were less and less innovations in programming languages, in the sense of features that have not existed in any earlier languages. Many new languages have been introduced since then and some of them might be better than most previous languages, but usually the new languages offer only new combinations of features that have previously existed in different languages and not anything really new. Ada is important, because in 1979 it included a few features never provided before. Some of those features have been introduced only recently in more popular languages, while others are still missing from most languages. For anyone who wants to create or improve some programming language, Ada is on a long list of mandatory programming languages that must be understood well, before attempting to do anything that is intended to be better. Sadly, there are many examples of ugly misfeatures in recent programming languages, which demonstrate that their authors were not aware about which was the state of the art 40 years or 50 years ago, and they solved again, but badly, problems that were solved well already in the distant past. Unfortunately Ada also had defects, some of which were mandated by the Department of Defense requirements. The defect that is most universally accepted is that it is too verbose.
- rezaprima 5y agoHow verbose is it compared to others like Go or Rust ?
- adrian_b 5y agoSomewhat more verbose. A great part of the verbosity is due to the fact that unlike CPL/BCPL/B/C and the languages inspired by them, which have replaced the Algol statement parentheses begin and end with "{" and "}" or similar symbols, Ada uses relatively long words as statement parentheses, e.g. loop and end loop. On the other hand, a good feature of Ada is that it followed Algol 68 in having different kinds of statement parentheses for different program structures, so you do not need to spend any time in wondering whether a closing "}" matches the one opened by a "for" or by an "if", many lines above.
- hoyd 5y agoAda was the programming language used when I took computing science in Glasgow, Scotland in 2002.
- naltun 5y agoFyt like the day in Glasgow?
- sambeau 5y agoIt was Pascal, Haskell* and C back in the 1990s. * and variants of Haskell, e.g. Gofer
- iamevn 5y agoWestern Washington University used it for intro CS classes until about 8 years ago. They switched to doing the professor's choice between Java and Python which most people seem to prefer now. Some of the professors do still use it for classes on concurrency and proofs. I really appreciated the sort of errors the compiler gives you but remember struggling to find good beginner level documentation. I kept landing on more specification-style docs which were more confusing than helpful. Also diving straight into Java after Ada was a shock.
- inamberclad 5y agoAda has every feature you could ever want to express programmatic intent.
- TuLithu 5y agoI apologize for the long quote, but I promise that if you read to the end, you will see that the discussion is germaine. "I want to point out again the difference between writing a logical and a psychological language. Unfortunately, programmers, being logically oriented, and rarely humanly oriented, tend to write and extol logical languages. Perhaps the supreme example of this is APL. Logically APL is a great language and to this day it has its ardent devotees, but it is also not fit for normal humans to use. In this language there is a game of “one liners”; one line of code is given and you are asked what it means. Even experts in the language have been known to stumble badly on some of them. A change of a single letter in APL can completely alter the meaning, hence the language has almost no redundancy. But humans are unreliable and require redundancy; our spoken language tends to be around 60% redundant, while the written language is around 40%. You probably think the written and spoken languages are the same, but you are wrong. To see this difference, try writing dialog and then read how it sounds. Almost no one can write dialog so that it sounds right, and when it sounds right it is still not the spoken language. The human animal is not reliable, as I keep insisting, so low redundancy means lots of undetected errors, while high redundancy tends to catch the errors. The spoken language goes over an acoustic channel with all its noise and must caught on the fly as it is spoken; the written language is printed, and you can pause, back scan, and do other things to uncover the author’s meaning. Notice in English more often different words have the same sounds (“there” and “their” for example) than words have the same spelling but different sounds (“record” as a noun or a verb, and “tear” as in tear in the eye, vs. tear in a dress). Thus you should judge a language by how well it fits the human animal as it is—and remember I include how they are trained in school, or else you must be prepared to do a lot of training to handle the new type of language you are going to use. That a language is easy for the computer expert does not mean it is necessarily easy for the non-expert, and it is likely non-experts will do the bulk of the programming (coding if you wish) in the near future. What is wanted in the long run, of course, is the man with the problem does the actual writing of the code with no human interface, as we all too often have these days, between the person who knows the problem and the person who knows the programming language. This date is unfortunately too far off to do much good immediately, but I would think by the year 2020 it would be fairly universal practice for the expert in the field of application to do the actual program preparation rather than have experts in computers (and ignorant of the field of application) do the progam preparation. Unfortunately, at least in my opinion, the ADA language was designed by experts, and it shows all the non-humane features you can expect from them. It is, in my opinion, a typical Computer Science hacking job—do not try to understand what you are doing, just get it running. As a result of this poor psychological design, a private survey by me of knowledgeable people suggests that although a Government contract may specify the programming be in ADA, probably over 90% will be done in FORTRAN, debugged, tested, and then painfully, by hand, be converted to a poor ADA program, with a high probability of errors!" - Dr. Richard Hamming, "The Art of Doing Science and Engineering..." Written in the late 1990s
- anyfactor 5y agoNot related to Ada but I just find it so fantastic that we still have sci-hub and we can conveniently share paywalled documents. I love sci-hub.
- pyjarrett 5y agoI've worked in a lot of different languages, and picked up Ada 2012 this year. I found it very productive and wrote a tool I use daily for professional development in it. It's verbose, but it's amazing how much all the work it forces you do up front saves you down the line. Built-in range checks for types, and pre/post conditions and invariants are interesting to work with. There's even a tool similar to Cargo, called Alire (https://alire.ada.dev/ https://alire.ada.dev/). It has its quirks, but overall I've been very impressed.
- deathtrader666 5y agoGiven that everybody has limited time to learn new programming languages, does HN recommend learning Rust or Ada?
- Jtsummers 5y agoThe consensus is probably Rust and even as an Ada fan/admirer I’d recommend it if you only have time for one. But you probably have time for at least a basic intro to Ada, and Adacore has some good and quick(ish) introductions at https://learn.adacore.com https://learn.adacore.com.
- kickitover 5y agoA technical and non-technical article on the development of the Ada programming language.
- Taniwha 5y agoWell it's essentially a PR piece, says lots of reasons why Ada is better than everything without actually showing any concrete examples
- gigatexal 5y agoThe Wikipedia article has some good stuff here: https://en.m.wikipedia.org/wiki/Ada_(programming_language) https://en.m.wikipedia.org/wiki/Ada_(programming_language)