3 ms·
Q: But why would I want to use Ada at all in the first place? Isn't it just some kind of historical language? A: I wouldn't know personally, but here's what th
by einpoklum 4y ago
Q: But why would I want to use Ada at all in the first place? Isn't it just some kind of historical language?
A: I wouldn't know personally, but here's what the Ada people say about this:
https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Developer/chapters/01_Preface.html https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Devel...
the main pitch point is that Ada is useful as a language you can validate code in, and thus more safe in scenarios where errors or bugs are critical and cost human lives.
Again, not sure if I buy this (especially w.r.t. to other languages with stronger safety features, not just C/C++).
- pyjarrett 4y ago> Q: But why would I want to use Ada at all in the first place? Isn't it just some kind of historical language? Ada is a peer language of C++, which is still in use today. I did a presentation at FOSDEM giving a high-level overview: https://fosdem.org/2022/schedule/event/ada_outsiders_guide/ https://fosdem.org/2022/schedule/event/ada_outsiders_guide/ Big picture: - straightforward language, once you've read a few hundred lines, you've pretty much seen 90%. - native, no GC, allows customized allocators and other low level control (e.g. alignment, layout) - had a proper package (module) system since inception, which makes creating and using crates for the new Alire package manager very natural - encapsulation and namespacing only at package, not at the type level - you put related types/operations in packages - it's more like writing strongly typed C with namespaces, than writing classes in C++. - no preprocessor or macros - bounds-checked arrays and strings are arrays, and not null-terminated - "access types" instead pointers. Each access type is unique (e.g. you could make two incompatible types which point to the same type) and can be assigned its own allocator. In general, pointer arithmetic prohibited, but can be done (requires built-in library and conversions). - built-in concurrency types - easy binding to C tl;dr It's like a simpler, safer, and more verbose C++, but you get a lot of compiler and runtime error checking for free.
- einpoklum 4y ago> It's like a simpler, safer, and more verbose C++ That might have been a tl;dr around 20 years ago. Now, C++ is very different having progressed along certain trajectories quite a ways. I would not characterize Ada as "An [XYZ]er C++" based on what you wrote.
- pyjarrett 4y agoThis comment wasn't meant to disparage C++, more to draw a comparison. As a C++ programmer, I find Ada very familiar in many ways, despite what would appear to be wild differences in surface syntax. A lot of things I do in C++, I can also do in Ada, though it's missing things like lambdas and move semantics.
- MaxBarraclough 4y agoAlso the runtime checks can generally be disabled by means of compiler flags. They aren't 'always on' like in the JVM.
- queuebert 4y agoI have used Ada in the past, and it is really a great language and quite performant. I'm convinced that if the Ada designers had gone with a C-like syntax the language would've been more widely adopted and tons of bugs would've been avoided.
- jkassie 4y agoAs someone who deals with both Ada and C on a regular basis, I think there was a bit of thought put into where they deviated from C-like syntax. https://learn.adacore.com/pdf_books/courses/Ada_For_The_Embedded_C_Developer.pdf https://learn.adacore.com/pdf_books/courses/Ada_For_The_Embe... does a good job of highlighting some of the differences between Ada and C syntax and the reasons for them.