4 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? Ada is a peer language of C++, which is still i
by 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.