I've got a few C projects for work, some of them inherited from p. terrible codebases. I'd like to use Ada for some of them. My thoughts went more or less as follows:
>let's write it in C
yeah, that works...
>let's write it in C++
that'd probably still be acceptable, but I don't like C++ and I'm not willing to invest the amount of time and effort into it that it'd take for a simple one-screen application to not commit some trivial mistake that makes it silently 50x times as expensive as it looks.
>let's write it in memelang
with a GC? No. Not for this stuff.
>let's write it in vaporlang
wow vaporlang is p. cool anon but I can't help noticing that there's no real documentation and that there are several breaking changes planned in the core syntax of the language.
>let's write it in cancer-curing superpowered superlang
after spending a year in deep meditation, I can finally say that I'm somewhat competent at curing cancer but... nobody is ever going to be able to read this code and I don't want the next maintainer of these projects to just instantly rewrite them.
>let's write it in Rust
the community is way too hostile towards and exclusive of people like me. I just wouldn't feel safe if I ever attended a Rust conference, you know?
>let's write it in Ada
OK.
gnatpp means not having to care about formatting.
Words_Like_This are impossible to type without RSI but they're very pleasant on the eyes and with a tiny bit of setup you can only ever type words-like-this.
actually the language as a whole is crazy easy to read. The only problem I've run into is that all the names are in one namespace so you can run into situations like
<what's a good name for a guard record type?
<How about guard?
<What's a good name for a guard variable?
<How about guard?
<oops, make that some_guard.
<Now let me pass this guard variable to a function:
<some_routine (guard);
<error: PC LOAD LETTER ??
<WHAT THE FUCK DOES THAT MEAN?
I started reading other material and only got "Programming in Ada 2012" late, but it seems like the best book to start with. In particular it goes through the standard libraries in a lot of detail. So far, Ada's impressed me in
1. you can create very precise numeric types and do all your work with them, and then the types themselves carry a lot of information that code can refer to. Ada has capabilities here that only experimental dependent-type languages are starting to rediscover.
2. you can use dynamic memory a lot less, because it's more natural to get an allocation from the caller (which can be stack-allocated) instead of allocating something and then expecting the caller to take it over.
3. Pre/Post conditions are amazing for code correctness. You read about them and you're like, eh, this is just assert(), but then they catch all your bugs without you putting any effort into them.
4. when you aren't blatantly trying to pass the name of a type as a variable, the compiler catches a lot and is helpful to a surprising degree. Hey anon you're not mutating that variable, want to make it constant? Hey anon you're switching over an enum but you missed a case, aren't you glad you're not writing Go right now? Hey anon you're testing to see if that variable is negative but by its type it should never be negative, are you high?
5. C FFI is very easy. There's even C header parsing, built into gcc, that generates Ada code for you.
6. Ada's generics.
I'm still looking forward to
1. pooled allocators. skimming "Programming in Ada 2012", I get the feeling that the pieces are all there for your own allocator and you just need to put them together.
2. something called 'controlled' types that manage their memory according to the scope of a variable? reference counting's also an option?
3. finding more ways to write less code. I only discovered "for X of BLAH" to loop over all the members of a thing (be it a multidimensional array or a hash table) yesterday.
4. understanding more of the costs of what I'm doing in Ada. You get 'copy semantics' on assignment but the language can cheat with parameters or something.