15 ms·
Not an expert in ADA, but after playing around with it for a while, I don't know why this language doesn't get more praise. It seems to solve a lot of the memor
by 3gg 6y ago
Not an expert in ADA, but after playing around with it for a while, I don't know why this language doesn't get more praise. It seems to solve a lot of the memory problems Rust solves, albeit in a different way. Its first-class arrays and strong type system seem to go a long way into not having to deal with pointers often, for example. These "features" today would likely be considered part of "a better C", except that none of this is even new; ADA dates all the way back to the 80s. And then ADA/Spark allows for formal verification, which C/Rust do not have to my understanding.
Why is ADA not adopted more broadly?
- jolux 6y agoWhy Ada Isn’t Popular: https://news.ycombinator.com/item?id=7824570 https://news.ycombinator.com/item?id=7824570
- kergonath 6y agoThat’s a bit old, though. Anyone can use GNAT now, and there are newer versions of the language. Even the discussion is dated: Ada 2012 is more widespread and there have been developments in SPARK.
- jolux 6y agoIt is old. However I think at least a few of the points stand, particularly about competition with C.
- jayp1418 6y agoThere was recent Thread with lot of discussion over topic :) https://news.ycombinator.com/item?id=24360310 https://news.ycombinator.com/item?id=24360310
- kevin_thibedeau 6y ago> Why is ADA not adopted more broadly? The Ada specification is huge. You can learn 90% of C with K&R 2.
- adamnemecek 6y agoThe problem is that using C in practice is not covered by K&R.
- atlgator 6y agoAny better books you recommend?
- adamnemecek 6y agoProgramming Rust by O'Reilly, haha.
- baq 6y agoI get why this is downvoted but it is solid advice: in C you absolutely have to track ownership and lifetimes of pointers and pointees, but the compiler is free to not help you in any way. Learning rust will make you a better programmer. Thus, the recommendation is very good.
- z3phyr 6y agoLearning any language makes you a better programmer
- mratsim 6y agoUsing* any language and writing non-trivial programs.
- steveklabnik 6y agoIt is not solid advice to suggest a book that's not even about the language that's being asked about. There's a number of reasons why it's not solid advice, but here's a huge one: you have no context for why the person is asking. Maybe they already know Rust, and want to learn C. It comes off extremely poorly. I downvoted your parent myself, even.
- bsder 6y ago> Why is ADA not adopted more broadly? I would argue that Ada suffered because IDEs weren't a common thing when it had its heyday. For example, Ada (and VHDL which took after it) is really verbose and a single change to a declaration can ripple all over the place. "Refactoring" is no big deal today. IDEs chop through it really easily. Back in 1990, on the other hand, you wanted to strangle a language that made you ripple a domain change of 0..255 to 0..65535 through all the code by hand. EVERYWHERE. There is a reason programmers are so huffy about "type inference", you know. Currently popular languages are quite "path dependent"--they needed to be popular before IDEs existed but still gain benefits when IDEs became commonplace. Now that IDEs are common, I suspect that some languages like Ada may slowly gain ground over time. There is far less need for a language to be "stupid editor" friendly. Edit: Change ADA to Ada.
- deleted 6y ago[deleted]
- foerbert 6y agoI agree with you, but I just have to say that if you're having to change a bunch of 255s to 65535 everywhere, you've done things poorly. Ada has a bunch of nice features to refer to these sorts of limits by names or methods that won't need to be changed. For those not familiar with Ada, one way might be MyInteger'Last, which will give the largest valid value for the type. I may or may not be a little crazy about Ada...
- bsder 6y ago> I agree with you, but I just have to say that if you're having to change a bunch of 255s to 65535 everywhere, you've done things poorly. Sure, but that was just one example that stuck in my head from using Ada 30+ years ago. I also remember one of my project partners threatening me with bodily harm because I wanted to change a name, and it was going to ripple through his modules. Perhaps there were better ways to do this in contemporary Ada. However, the fact that people using the language didn't find them says something, no? A whole class of us absolutely LOATHED Ada because of this kind of stuff. An entire engineering class learned to reach for FORTRAN (unsurprising as it was just beginning its decline) and C (a little surprising as it really wasn't a juggernaut yet) instead of Ada. That says something about Ada, and it isn't good. Sure, we weren't geniuses, but we weren't stupid. If Ada had been useful help to our classes, we would have used it. The HP-28/HP-48 came out in a similar timeframe and EVERYBODY in our class jumped on those in spite of them being $400+ (1988-1990 money) and having to use RPN--being able to chew through matrices on a calculator was huge. Maybe modern Ada doesn't suffer from these kinds of problems (or, at least has decent IDE support to deal with it), but it certainly pertains to the path dependence about why Ada isn't popular.
- svvcfb1212 6y agoAda, not ADA. It’s named after Ada Lovelace, not an abbreviation.
- carlmr 6y agoI thought it was both. But I never bothered to ask what it abbreviates.
- KingOfCoders 6y agoYou are right, but it could be both.
- Lucretia9 6y agoNo, it really cannot. It's a person's name.
- carlmr 6y agoAmericans really love acronyms that spell out a word. BASIC is a word, and it means Beginner's All-purpose Symbolic Instruction Code. I don't know why you think it's impossible to have an acronym spell a name?
- mitjak 6y agolol because it's not an acronym in this case, as stated
- carlmr 6y agoThe previous poster said it could be both, not that it is both. Apparently a lot of people think it is, which is because it's such a commonplace phenomenon. That it is a person's name is orthogonal to whether it could be an acronym.
- KingOfCoders 6y ago
- nl 6y agoI did Ada at Uni. I think it's an ok language but its Pascal roots show. In an alternate universe where Pascal won instead of C (which it nearly did!) it might have ended up where C++ is. Pascal being the choice for Systems programming instead of C nearly happened. One of the first things Ken Thompson and Bill Joy wrote for BSD was Pascal, and the Apple Lisa system was mostly written in Pascal.
- yjftsjthsd-h 6y agoHonestly, I wonder why Pascal doesn't dominate, too. Safer than C while still just as powerful, "teaching language" (easy to learn) but used for serious software (as you note, Apple used it for system programming). FPC is amazingly feature rich.
- non-entity 6y ago> "teaching language" (easy to learn) I think that worked against it as well.
- EdPF 6y agoThe thing I saw with Pascal in the late 70's / early 80's was that in order to handle industrial use cases, each computer company invented its own dialect (I worked on one at Burroughs). That was one of the problems Ada addressed. But its initial problem was the cost of compilation and builds on the hardware of the time. That got sorted out by the end of the 80's, but then other factors like contractors not wanting their customer telling them how to do their work came into play. Sort of a confusion of requirements and implementation methods.
- KingOfCoders 6y agoI would prefer Modula-2 where I do like the module system.
- pjmlp 6y agoBecause Borland lost their way and Turbo Pascal/Delphi was the leading Pascal implementation, so eventually most Pascal lovers moved into Java/.NET.
- protomyth 6y agoI could get Turbo C or Turbo Pascal, there was no Turbo Ada. It has never had a compiler / IDE that made it easy to write Windows or Mac applications.
- goatinaboat 6y agoIt has never had a compiler / IDE that made it easy to write Windows or Mac applications Well, it did, it just cost $50k/seat.
- EdPF 6y agoA little exaggerated. From the 90's there were a couple (Janus, Meridian) at about $600 a seat.
- Rochus 6y ago>> It has never had a compiler / IDE that made it easy to write Windows or Mac applications. Are you talking about the Eighties? GNAT is available for free since the nineties and the GPS IDE is available for free on all relevant platforms since nearly twenty years; even before there were IDE like alternatives for free.
- 7thaccount 6y agoThe free part is confusing as it is GPL'd and I don't understand what the runtime exceptions mean. It's confusing to me where the boundaries are and when I would have to switch to the commercial version (and get a quote) to make paid and closed source software instead of using the community language. Ada is great, but I'll never use it past hobby status under these conditions.
- Rochus 6y agoThe FSF GNAT version, in contrast to the AdaCore GNAT version, comes with the RLE (see https://www.gnu.org/licenses/gcc-exception-3.1.de.html https://www.gnu.org/licenses/gcc-exception-3.1.de.html). This means that the code generated from closed-source Ada applications may be linked with the runtime library included with FSF GNAT without GPL violation. With the runtime library included with the AdaCore GNAT this is not true. So in practice you have to use FSF GNAT for closed-source applications unless you're willing to pay for the AdaCore GNAT. This is mainly an issue if you need to compile for a processor architecture for which there is no FSF runtime library.
- moonchild 6y ago> ADA/Spark allows for formal verification, which C/Rust do not have to my understanding. Check out Frama-C: https://frama-c.com/ https://frama-c.com/
- baybal2 6y ago> Why is ADA not adopted more broadly? Productivity, and the general labour intensity. Formal verification is not critical for the lion share of all software, and people obviously would like to save man hours by not dealing with it. Second is the availability of developers. Not many people even now what formal verification actually is, let alone see rationale for learning verification driven development.
- carlmr 6y agoYou can use ADA without the Formal verification part. I would say at least for embedded systems it's more productive than C because it has a much stronger and expressive type system. E.g. if you do a lot of fixed-point math, ADA's type system can express it. ADA has proper arrays, with bounds checks. ADA has built-in multithreading. ADA is a very productive language for embedded systems, much more so than C. But people are afraid of the language, because they think it's difficult. People don't want to learn it because they think it's old, although ADA 2012 is a much more modern language than C11, it hasn't stagnated as much, but it also evolved more deliberately than C++, keeping it's focus on useful features, instead of adding all the features. At the same time it makes a lot of things easier in an embedded context, because it was designed exactly for this use-case. The only issues are the lack of developers and the ugly syntax, but I think any C developer could learn what they need to be productive in a month, and the syntax you can get used to.
- sacado2 6y ago> ADA has proper arrays, with bounds checks. Not only that, but you can also opt out at compile-time if you need, for performance reasons. You also have (optional) runtime bound-checking for scalar values (aka "integers"), and you can even specify the bounds yourself (like "A number between 3 and 17").
- acqq 6y agoProper bounds checked arrays, possible to opt out, integers with bounds: Turbo Pascal had that too.
- kats 6y agoIt requires a license to use GNAT for commercial projects, it's not free like many C/C++ tools.
- pjmlp 6y agoGCC only started to matter after UNIX vendors stop offering their SDKs for free actually.
- mhd 6y agoUneven C++ support was a big issue, too.
- MrMorden 6y agoFSF GNAT (from your distribution) can be freely used. The GNAT that makes output GPL is the GPL GNAT edition downloaded from AdaCore's website.
- synack 6y agoYep, the GNAT toolchain in Debian is actively maintained and they even build cross compilers for all of Debian's supported architectures. Combined with a Linux RT kernel, you can get some pretty good performance with only GPL code. If you need to build for bare metal rather than Linux, things get a bit more complicated as GNAT requires some runtime code to setup things like systick and interrupts. You can use AdaCore's non-GPL runtime for non-commercial purposes, cortex-gnat-rts on top of FreeRTOS, or RTEMS, which natively supports Ada (though it's poorly documented). I've also had some luck using crosstool-ng to build gcc toolchains with Ada support, but you'll still need to find or write a runtime library for bare metal.
- pjmlp 6y agoNVidia is also using it, in fact they decided against Rust when evaluating which language to adopt for their "Safe Autonomous Driving" project. https://blogs.nvidia.com/blog/2019/02/05/adacore-secure-autonomous-driving/ https://blogs.nvidia.com/blog/2019/02/05/adacore-secure-auto...
- fluffything 6y agoWhere do they mention that they decided against Rust ? Ada is certified by ISO for being used in automotive control systems. Rust isn't. So I'm not sure how Rust could have even been an option. AFAIK, the options are Ada, MISRA C, and certain Forth flavors. That's it. I'd take Ada over these alternatives every day.
- pjmlp 6y agoThe session that they did together with AdaCore presenting which languages they went through and why they picked Ada in the end. Rust syntax was one of the factors that played against it. "Securing the Future of Safety and Security of Embedded Software" https://www.adacore.com/webinars/securing-future-of-embedded-software https://www.adacore.com/webinars/securing-future-of-embedded... Page 35, https://www.slideshare.net/AdaCore/securing-the-future-of-safety-and-security-of-embedded-software https://www.slideshare.net/AdaCore/securing-the-future-of-sa...
- jimktrains2 6y agoWhere does it say syntax is against rust. It seems like no commercial vendor meaning no plans for certification combined with no spark equivalent we're the reasons.
- pjmlp 6y agoWatch the video, slides are just one part. Part of "Determine the difficulty and learning curve for others".
- mjw1007 6y agoIn the 80s, largely because compilers were expensive. I think it had a (smallish) second chance in 2001, when GNAT was put in the main GCC tree. By then plenty of people were disillusioned with C and C++, and I think it could have got momentum in a way similar to how Rust has (by appealing to programmers' pride in producing less-buggy programs). But the Gnu Ada maintainer was also the person running Ada Core technologies (who sold the proprietary version of Gnat), and wasn't at all interested in making sure the free version worked out of the box on Linux distributions, or promoting Ada as a language for writing free software.
- jacobush 6y agoYes, I remember a tiny buzz around 2001 for it. I considered it but I couldn't find much information and then Python distracted me for a decade.
- Someone 6y agoCompilers also were relatively large, at least in part because the language is large. For example, it has generics, tasks and inter-task communication. C compilers did not need to have those in the 80s. That mattered at a time when many users wouldn’t have a hard disk.
- nraynaud 6y agothe free version of gcc gnat is garbage, it randomly crashes during compilation, the timers are based on a subdivision of systick on STM32 (good luck for accuracy or high frequency). So basically you need to already be wealthy to just dip into it (buy a licence of Adacore and a supported expensive aero grade MCU test kit). I stopped messing with it 5 years ago.
- marktangotango 6y agoDoes anyone have more recent experience? Is this still the case?
- nix23 6y agoThere is even an AdaDoom :-)
- agumonkey 6y agoEducation, ADA was under the radar, and only taught in a few colleges I believe. And even where it was taught, it would be drowned in Java classes.
- geofft 6y agoAda doesn't have compile-time-safe dynamic memory allocation and deallocation (i.e., tracking a pointer so that you know statically that it's no longer used elsewhere in the function that frees it). Rust does it through the lifetime system, which is based on Cyclone, which long postdates Ada. The usual alternatives are to statically allocate all your memory, to convince yourself it's safe to use Unchecked_Deallocation, or to use a GC/refcounting library. Static allocation is usually not a problem for special-purpose embedded control applications: e.g., your airplane has two wings and one set of landing gear and its position is described by three coordinates, and you'll never need more of those. You probably want to avoid malloc anyway for both predictable performance and not having to worry about whether your allocation will succeed. But if you're writing, say, a CSS engine or a grep replacement or a terminal emulator, that approach won't work. GC works for those use cases, but there are a number of excellent memory-safe GC'd languages already in wide use for many things, like Python and Java. You can get very good steady-state performance with Java, sometimes higher than equivalently-complex C, but it's still not a language you'd want to implement loadable libraries or OS kernels in. Rust solves the problem of making writing high-performance, C-drop-in-replacement code feel much like (definitely not exactly like :) ) working in a higher-level language like Python or Java, including the memory-safety parts of that experience. Ada addresses memory safety, but for most of the use cases people are excited about Rust for, they want the combination of those features. For things like flight control software, picking something extremely mature (usually the companies in these press releases have existing Ada code from previous projects dating back decades) is valuable and having safe dynamic allocation isn't really a requirement.
- Rochus 6y agoAs described in another post Ada has features to avoid the problem Rust want's to solve in most cases. You can e.g. allocate varable length arrays on the stack.
- kqr 6y agoAda also lets you create ad hoc local reference types and disallows references escaping beyond the scope of their type. This is an insanely powerful combination for ensuring references do not leak beyond where they are supposed to.
- sai_c 6y agoBecause Ada is not a language for quick and dirty. It's a language that is only fun and usable if you apply engineering methods to the whole project (a.k.a requirements, documentation etc.). Most projects out there don't. Quite frankly, it's not a hackers language. EDIT: Oh and the price tag.
- foerbert 6y agoIt's in gcc. Or available from AdaCore under GPL-3 (yeah, I know). Unless you're in the sort of position where you need a support contract anyway, price isn't really an issue.
- sai_c 6y agoYes, I know it is in gcc. But compared to the AdaCore version, there are way too many bugs (at least when I played with it in 2018). And for any commercial endeavour (even if just a small company, say one or two developers) you really need the support contract (for fast bug fixing the compiler etc.). That's from my experience. Remember, it was about widespread adoption. With the above described small shop situation, there is no pricing that is payable by those shops. And the GPL 3 version does not help here. At least I haven't seen a solo developer going from "I created this amazing thing with the GPL version" to "I can now afford the commercial license of 20000€ per seat".
- foerbert 6y agoMy experience is vastly different from yours. I've been using Ada as my main language for personal stuff for some years now... I can't quite recall when, but call it 5+ years? I won't say I've never run into some kind of problem with Ada on gcc (aka FSF GNAT), but it's been pretty minimal and easily avoided. I think it's been a grand total of two or three bugs that I've known of in that time. I've also run into known gcc bugs with C++ before so the situation doesn't seem particularly bad to me. I find it hard to believe a solo or duo dev shop has a real need for a support contract for their compiler. What language can you get a support contract for that is affordable by anyone?
- Keyframe 6y agoTooling-wise there's only one game in town. That's the primary reason.
- NationalPark 6y agoCompare the Ada getting started page to the Rust getting started page: https://www.adacore.com/get-started https://www.adacore.com/get-started vs https://www.rust-lang.org/learn/get-started https://www.rust-lang.org/learn/get-started Ada asks you to compare four versions of GNAT and prominently displays "request pricing" buttons. Rust gives you a compiler, a package manager, some IDEs with Rust integrations, and a link to the Rust Book. In point of fact, Ada has quite a bit of historical baggage/inertia as a proprietary language sold to well heeled defense contractors while Rust has a great deal of effort put toward community engagement and onboarding. Given that Rust now has a "cool" factor that Ada lacks, it's not surprising that people in the "market" for features both languages provide would gravitate to Rust (or other less popular but more engaging systems language communities).
- steveklabnik 6y agoI decided to take a weekend and poke around with Ada last year, and wrote a stream-of-consciousness blog post about it https://steveklabnik.com/writing/learning-ada https://steveklabnik.com/writing/learning-ada
- gumby 6y agoAda a proprietary language; quite the contrary: it was standardized right up front, in an effort by the DoD go get a common language at a time when proprietary languages were the norm. That’s about the only nice thing I personally have to say about Ada so I’ll stop here.
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- tasogare 6y agoRust is akin to the JS framework du jour in respect to safe languages: overpaid bored engineers started a project without bothering checking existing work or dismissing what they found, then they market the resulting (still unfinished) language as something radically new and solving most programming language issues. Some people followed because of the novelty effect and the company that spanned it, which allowed for the hype train to start in places like NH. Rust is a social phenomenon not a technical one. (This post is sponsored by the Rust Paganization Strike Force)
- c-cube 6y agoThat is just incorrect. Ada seems pretty nice, but it does not have a borrow checker, does it? I think deallocation is considered unsafe? Documentation points to [Unchecked_Deallocation](https://docs.adacore.com/live/wave/arm12/html/arm12/arm12-13-11-2.html https://docs.adacore.com/live/wave/arm12/html/arm12/arm12-13...) . Rust has automatic (as in, you don't even need to call `free()`), safe deallocation of resources. Of course, the syntax, ergonomics, and the modern looking website and documentation also helped rust become popular, but it is technically new (for a mainstream language).
- OneWingedShark 6y ago> Ada seems pretty nice, but it does not have a borrow checker, does it? IIUC, there is a SPARK implementation that does: https://blog.adacore.com/using-pointers-in-spark https://blog.adacore.com/using-pointers-in-spark / https://www.adacore.com/uploads/techPapers/Safe-Dynamic-Memory-Management-in-Ada-and-SPARK.pdf https://www.adacore.com/uploads/techPapers/Safe-Dynamic-Memo... That said, there are whole classes of problems where, thanks to Ada's design, you don't even NEED pointers where you would in C or similar languages: http://video.fosdem.org/2016/aw1124/memory-management-with-ada-2012.webm http://video.fosdem.org/2016/aw1124/memory-management-with-a... > I think deallocation is considered unsafe? This too depends; Ada was designed so that a garbage-collector could be used, even in Ada83, most implementations do not take advantage of this. (There are JVM and DOTNET implementations where GC is required though.) To achieve safe deallocation it is often delegated to scopes so that exiting a scope clears out all the memory you were using; see stack-allocation, pools/subpools, and local-declarations/inline-declarations.
- deleted 6y ago[deleted]