14 ms·
Every time I see something on Ada, it seems like a really nice language. Easy to read, easy to write, performance seems to be there with C++, easy (?) to interf
by Keyframe 10y ago
Every time I see something on Ada, it seems like a really nice language. Easy to read, easy to write, performance seems to be there with C++, easy (?) to interface with C, multi-threading seems to be somewhat easy too...
So, what's the deal, where's the catch? Why people aren't jumping on it like they do with, I don't know, Rust?
- goatlover 10y agoAda is like Smalltalk or Lisp at this point. It's not new and shiny. It's not being marketed. It's seen as outdated, or even extinct (how many people know an Ada developer or project)? Like it or not, people bandwagon technologies. Not to say anything against Rust, Go, etc. But how many people who have jumped on one of those bandwagons did so after examining Ada, and found it wanting in comparison, do you suppose? There's also the expectation that a more modern language will have modern tooling people today need, and community support easy to find (if it's caught on).
- femto 10y agoI'd expect someone who knows VHDL could get up to speed on Ada pretty quickly. VHDL is a widely used Hardware Description language, which was derived from Ada.
- gaius 10y agoPL/SQL is also derived from Ada.
- pjmlp 10y agoWhich makes me a bit happier every time I have to dig into our stored procedures. :)
- user5994461 10y agoTo have done [a bit] of both. I doubt that.
- catnaroek 10y agoRust demonstrably gives you stronger static guarantees than Ada, which, just like C++, is a lot larger than C, for relatively little benefit in terms of safety.
- Avshalom 10y agoThough SPARK gives you stronger guarantees than rust.
- fghgfdfg 10y agoI completely disagree with those statements. Rust can give stronger static guarantees in simpler instances. When it comes to more complex cases, neither language can guarantee much. Ada however has better mechanisms for handling them safely. For example, you can specify a particular allocator for individual types rather than relying on each allocation to use the custom allocator. If you're outside the realm of the Rust borrow checker and want to use an arena to keep the memory side of things simple and safe, it's much easier to do properly in Ada. Ada is also significantly safer than C. Between the much stronger type system, memory safety facilities, bounds checking, non-nullable pointer types, generics, contracts etc. it's clearly a much safer option than C.
- vertex-four 10y agoIt's relatively easy to create a type which can't be created at all by functions outside the module it's defined in - add any private member. Then that module is in control of how it's created, and can set any restriction you like. This pattern is regularly used in Rust to ensure that types are always initialised correctly.
- fghgfdfg 10y agoSure, you can do things like that too in Ada. To some degree that might make sense sometimes, but having the option of an equally safe type that's used in a "normal" fashion, rather than something that has to go through the proper library interface has some advantages as well.
- planteen 10y agoYou see Ada used in legacy code bases in aerospace and defense. A big problem, at least at an ex employer of mine, is that no young engineers have a desire to learn Ada. It completely pigeonholds you to the aerospace/defense industry's legacy systems.
- marssaxman 10y agoThat's been true for at least a quarter century, since I was a young engineer hearing Ada mentioned as another one of those fusty old legacy languages like FORTRAN or COBOL. Even if I'd felt any interest in trying it out, I had no access to any Ada compiler.
- jdboyd 10y agoPerhaps you didn't have access to an ADA compiler 25 years ago, but GNAT has been free and open source for about 20 years and part of GCC for more than 15. Of course, 20 years ago, ADA was already 15 years old, so no surprise that when it became accessible it was already branded fusty.
- flomo 10y agoEven back in the 1980s, ada had a "stodgy government bondage & discipline language" reputation. At least among the hacker set, who back then was all about bit-banging the machine. I'd speculate that ada never received the big commercial push, like Sun Java received. There were no salesreps talking up ada on the golf-course to CIOs, and there weren't marketing people planting 'Ada is great' stories in the popular press. It always had "the pentagon made me use it" aura around it.
- pjmlp 10y agoIt may be wrong, but from occasionally attending Ads talks at FOSDEM, I got the idea that at least in Europe in what concerns high integrity systems, Ada's has be slowly increasing. Also quite a few European universities do seem to teach it nowadays.
- a_imho 10y ago
- Avshalom 10y agoIt's old so it's unfashionable. Before that it was expensive and that thing the DoD made by committee. Concurrently with both it's pedantically typed which wasn't very popular until last year.
- douche 10y agoIt doesn't have that novelty factor. One could ask similar questions about D, which has for a long time positioned itself as a friendlier C++, but hasn't had any of the buzz that Rust or Go or Nim, etc have garnered.
- goatlover 10y agoWhich is kind of shame. D looks like a really nice systems language.
- qznc 10y agoIt had serious problems back then. You are correct about D2.
- Keyframe 10y agoA bit tangential, but I did (heavily so) jumped into D before D2 and kind of got burned with that. I married D1 which was more in-line with "a better C" and then everyone decided D2 was the way to go, which was more "a better C++". It was to be expected though since language was in flux a lot at the time. Ada is a stable language though. I get what goatlover and Avshalom here are talking about here. That it's not fashionable (anymore). If we remove ourselves from that, are there any specific technical reasons why Ada hasn't been picked up by, let's say, C++ programmers? That is, audience that needs performance, yet also a nicer and safer language. With Lisp(s) there was a long period of basically having to pay for a good implementation and runtime deployments to Franz for Allegro if you wanted to do something well on desktop. I recall only Nichimen with Mirai and Nendo doing it, and it was fabulous. Makes you think about what would happen if tooling was free at the time, or at least more affordable. From everything I've seen, so far, Ada seems to be technically ready language to do game development, where probably most of language-curious crowd lives these days. I'm not sure about mobile support though (gcc on Android or whatever it is on iOS). Every now and then I take a week of spare/hobby time and endeavour into new and weird technical spaces. Maybe, my next one will be in Ada space.
- pjmlp 10y ago
- agumonkey 10y agoIt's off the radar, but lots of people use it, even for today's needs: https://duckduckgo.com/?q=ada+embedded&ia=web https://duckduckgo.com/?q=ada+embedded&ia=web Not long ago I found articles about ADA Generics and low level code (I was looking for swappable network stack in theory), it was pretty interesting. I can't find the bookmarks for now.
- agumonkey 10y agoCouldn't find the Generics one, but here's a few I could gather: Why Ada isn't Popular (1998) (adapower.com) HN Thread https://news.ycombinator.com/item?id=7824570 https://news.ycombinator.com/item?id=7824570 RTS http://jalada.co.uk/category/rts http://jalada.co.uk/category/rts Ada Gems http://www.adacore.com/adaanswers/gems/ada-gem-13/ http://www.adacore.com/adaanswers/gems/ada-gem-13/ Ada Interrupt handlers http://stackoverflow.com/questions/10640108/ada-interrupt-handlers http://stackoverflow.com/questions/10640108/ada-interrupt-ha... TBC
- joewing 10y agoI like Ada a lot, and I've been known to push it, only half-way kidding, on many occasions. However, there are a few things that make the language somewhat annoying to use, especially for someone who is accustomed other up-to-date languages (Python, C++11, Java, Scala, etc.). The obvious one is probably the verbose syntax, but really I don't mind it too terribly much (writing "function bah return integer is begin .... end blah" does get a little old though). Here's a list: * No type inference. The lack of type inference means that I end up typing the names of types all over the place (or renaming them to be short, which doesn't really help the reader much). * No lambdas or closures. I really want to be able use higher-order functions, but Ada makes that difficult. * Extremely verbose generics. Ada has amazing support for generics, but there's so much overhead to use them (syntacticly) that I usually avoid them. * Strange dispatch syntax. I personally like it, but it is strange to those more accustomed to C++ or Java, where methods are part of the class. In Ada, methods are declared as taking a "tagged" type as a parameter. Related to this, I really think Ada should support multiple dispatch (if you're going to have the strange syntax, why not?).
- Keyframe 10y agoActually, everything you've listed seems like a good fit for a C programmer (me) to give Ada a serious spin. Maybe not for a C++ programmer. In the meantime, I've learned about the existence of "-fdump-ada-spec" for both gcc and g++. Apparently, g++ driver is preferred, even for C code. How cool is that? Automatic thin wrappers for your existing code with nothing more than a 'g++ -c -fdump-ada-spec -C super_awesome_code.h'. I've just tried it on a somewhat large-ish codebase which has a single .h as an entry point and it created a bunch of .ads thin wrappers with only two unsupported macros (one doesn't matter and the other is for dllimport/export shit). If this works, it might be an easy ticket into Ada adventures for a C programmer.
- fghgfdfg 10y agoI'm pretty familiar with most of these issues, except for the one about verbose generics. What do you find so verbose about them? To my thinking they aren't much more verbose than C++ templates. They end up being a short little section above the place they are used. However I don't really feel like it's a verbose language in the first place (even if there are a few more characters around) so perhaps I'm just missing something entirely.
- catnaroek 10y agoThe article itself says: > There’s a generic function in the standard library called `Ada.Unchecked_Deallocation`, which frees memory to the heap. A systems language without a safe resource finalization story is simply an unsafe language. This isn’t some fringe use case. Finalizing resources is a common operation in systems programming. Other “benefits” of Ada just consist in bloating the core language with stuff that can be reasonably done in libraries: bounds checking (in ML, this is just a functor that produces an abstract type of bounds-checked integers), concurrency abstractions (as Rust has shown), etc.
- pjmlp 10y agoJust like Rust with unsafe blocks. There are ways in Ada to write programs without ever having to call Unchecked_Deallocation. Good luck having the compiler eliminate bounds checking for library code.
- flyx86 10y agoFor safe resource finalization, Ada provides `Ada.Finalization.Controlled`. This enables you to implement RAII, smart pointers, and other ways of safe finalization. `Ada.Unchecked_Deallocation` is just the bare-metal tool you can implement more intelligent finalization with (because in the end, someone needs to deallocate the memory).
- catnaroek 10y agoWithout substructural types, no matter how much lipstick you put on the pig, use after free will always be possible.
- Tomte 10y agoCompilers and Tooling. The GNAT frontend always felt like second-class in gcc, and the "real GNAT" was incredibly expensive.
- pjmlp 10y agoFor one thing, age. I get the impression most people jumping into Rust, go into computers after C and C++ became the widespread tools for systems programming, which makes them unaware that there was a time when safer systems programming languages did exist. So they got biased in that regard. Second Ada compilers used to only be available in enterprise prices, and they still are. GNAT is the only one available as open source, the ones from PTC (they bought Aonix and Atego ones), Green Hills and a few surviving others are still sold by having to call their sales guys. Finally, Rust does offer more safety features over Ada, like the lifetime management or type inference. Still, it would be nice to see more Ada love in the industry.
- _pmf_ 10y agoCatches: - having to write separate interface files (analogous to header files in C) - only one relevant compiler vendor; somewhat bad history with GNAT not supporting all the features the commercial AdaCore tooling supports. AdaCore has IMO been instrumental in holding back adoption of Ada, although they probably see themselves as evangelists. - no metaprogramming - the way generics work is a bit peculiar: it's less powerful than C++ templates (but a bit easier to learn) and slightly more powerful than Java/C# generics, but I find it to be a weird middle ground. I implemented some generic graph traversal algorithms via generics, but it felt like jumping through hoops (although once tackled, it was very robust and extensible).
- pjmlp 10y agoAs a side note generics are quite similar to how they are done in Modula-3 as well.
- flyx86 10y agoInterfacing with C is actually a lot of work. Not that it is not possible, but if you write a light wrapper, you end up with all the low-levelness that makes up C. If you want to use a C library „the Ada way“, you need to wrap almost every C function with an Ada function that transforms C pointers into Ada arrays (remember, [] in C is just a pointer with no dope), C defines into Ada enumerations, C function pointers to Ada subprogramm access types and so on. This amounts to a lot of work. For example, my OpenGL Ada wrapper is roughly 10,000 lines of code. But it does do extension loading and resource management automatically (in contrast with the raw C API) and all defines have been translated to enum values so you can call functions only with values they can handle.
- pjmlp 10y agoThe same applies to C++ APIs done properly, sadly due to the copy paste compatibility, we end up with a pile of C bindings. This is specially visible when comparing nice C++ libraries like OWL and VCL to MFC.
- acomjean 10y agoThis is totally true. Interfacing with other languages is important. The operating system is in C, so to use all the operating system provides, the networking, shared memory, IPC you need a wrappers. If your sharing data with C code, you need to make sure you ada records match your C Structs so they align correctly. Ada was remarkably good at letting you set where things went in memory for each record. Part of a past job was to write and maintain ada wrappers for a large Ada project.
- jonathanstrange 10y agoI'm using Ada for time-critical code in my hobby projects. In my opinion, there are four major catches: * Long learning curve: The syntax is unusual in that it is specifically defined for every construct of the language. That makes the learning curve long, because you need to grasp the possibilities for every syntactic construct separately and there is some multiple uses of keywords like "with". Generally, conceptual simplicity is not a strength of Ada. * String handling: In an attempt to please everyone, Ada provides fixed-length strings, bounded-length strings, unlimited length strings with byte-sized chars, wide chars, and wide wide chars and you have to convert between these representations all the time. Nevertheless, it only supports UCS encoding, not UTF, in the core language. So to e.g. use UTF8 strings, you either have to abuse ordinary byte-size char strings, which is a type error, or use an external package plus all the conversions to and from the internal format. It's a constant pain in the ass and source of non-portability, and they should have included full support for UTF8 and/or UTF32 in the recent standard. * Too strict aliasing rules: Apparently to keep the static compiler checks simple, Ada's rules for pointers (aka aliases) are sometimes too strict, i.e., you may sometimes not be able to use pointers to procedures and heap-allocated objects even when it is provable that they cannot dangle. This can create major problems or force you to do unsafe conversions or overlays, if you don't design your application carefully. Arguably, there are only rare cases in which you should use pointers and you generally don't need them very often in Ada. But it can be a tumbling stone for people coming from C or C++. * Licensing & vendor lock-in: If you install AdaCore's version, your programs become GPL! If you don't like that, you need to install FSF's version, which does not come with some essential libraries from AdaCore that are also GPL. However, evern FSF's version is only mGPL, not LGPL, meaning it is GPL with a runtime exception. Generally speaking, license confusions have kept many people from using Ada. Moreover, the only really modern compiler comes from AdaCore (who contribute GNAT to gcc), other compilers only support Ada95 and are prohibitively expensive anyway. So there is also a certain vendor lock-in, and e.g. fear that AdaCore might stop contributing to the mGPL version. That's a big issue for anyone who would like to use Ada for business without buying expensive licenses from AdaCore. Basically, AdaCore is a dubious player, not a role model of a successful open source software company, as it is sometimes portrayed. Other than the above, Ada is a fantastic language. Once your code compiles, it nearly always works, and you will be able to understand it years later even if it is undocumented. Ada really is self-documenting and fast, that's why I use it. Edit: Forgot one thing. It's also a disadvantage that no current Ada implementation has a GC (although a GC is compatible with the standard). Since it has become trendy to bash GCs and advocate manual memory management for mostly unsound reasons anyway, the point didn't make it in the list above.
- ziotom78 10y agoI tried to use Ada for some numerical code I was developing a few years ago (see this old blog post of mine: http://ziotom78.blogspot.it/2012/09/discovering-ada.html http://ziotom78.blogspot.it/2012/09/discovering-ada.html). The language is fantastic, and the type system is perfect for describing physical quantities which can only assume values within well-specified ranges. However, what made me put aside Ada is the lack of scientific libraries. Nothing similar to NumPy/SciPy/LAPACK/FFTW/GSL/ATLAS... exists, and writing nontrivial bindings to C libraries is extenuating. The problem is not to write thin bindings: this is almost immediate, as the post shows. But if you want to take advantage of Ada's features, you want thick bindings. And this is a long and complex process. I was able to create bindings to a few CFITSIO functions (https://github.com/ziotom78/adafits https://github.com/ziotom78/adafits), and it took more than expected. When I realized that even completing this set of bindings would have been just a small step towards the kind of full scientific stack I need for my daily job (I'm an astrophysicist), I gave up with Ada. I think the same situation applies for other fields than astrophysics. How many Ada bindings to commonly used libraries (e.g., ZeroMQ, dbus, bzip2, libjpeg, libunicode, Qt, OpenGL, glib, etc.) exist today?
- Keyframe 10y agoIt seems the real technical issues are surfacing as the posts flow in. There are two. Primary being that burden/control is in one company's hands and the other being lack of (thick) wrappers for C libraries. That other issue is common among less popular languages. First one is concerning, not much because of potential malevolence of Ada core, but more that they seem to do a lot of work and that can present itself as a bottleneck. On a sidenote, you're an astrophysicist? How awesome is that?! I'm in TV and Film, and I wanted to meet/know one who I can pester here and there with questions/collab for an SF script development I had in mind which I would like to present in 'accurate' way.
- ziotom78 10y agoAgreed. At the end I turned to Python + Fortran (via the awesome f2py) for almost everything, although using two languages is far from ideal. It confuses students which hardly know just one of them, plus there is the cognitive burden of using two different sets of conventions (e.g., zero-based vs one-based array indices) and models of computation. I don't know how much help I could give you regarding your script, but I would be happy to help. Feel free to contact me, my email is maurizio dot tomasi at outlook dot com.
- progman 10y agoAs for me, Ada is an excellent language for safety applications but too much under control of a single company. GNAT is open source, that's fine. However, despite this fact it is almost impossible for someone to write a new Ada compiler, or a transpiler from a modern syntax to classical Ada because there is no complete BNF grammar out there. I honestly planned to write such such a transpiler but it didn't work out because I lacked a fully specified BNF grammar. I complained about that in an Ada forum, and the insiders there confirmed that there actually is no downloadable BNF. There is just a BNF for Ada 95 which is pretty outdated. So, if I wanted to get the full BNF for Ada 2012+ I would have to dive into all the Ada Reference Manual and Rationals to scratch a suitable grammar together. That's way too much effort for me.