1. 22
  1.  

  2. 4

    The most intriguing thing to me with Ada is ranges on numeric types.

    1. 4

      You might find the existential types interesting. It means they’re all unique and incompatible by default. So, Miles with Integer representation and Kilometers with integer representation won’t mix since the types don’t match.

      1. 2

        Those are neat too.

        The range check sticks out to me though because I’ve had to debug a few things where range checks would have helped.

        1. 6

          As nickpsecurity says, the even nicer, more general concept is contracts, i. e. boolean conditions that can be attached to various things, including types. With type invariants specified you can have arbitrary conditions automatically checked on the values of your types, including ranges.

          Preconditions, postconditions, loop invariants and type invariants are the things I miss most from Ada in other languages.

          1. 4

            Well, it makes sense given our variables operate on ranges of memory and values but the languages weren’t enforcing them. Ada lets you do that. It’s actually an instance of contracts or formal specs. Design-by-Contract gives you ranges and more.

        2. 1

          If you enjoy ranges on numeric types you might also enjoy XML Schema.

          1. 1

            I didn’t say “enjoy”, I used “intriguing” since it would make the language/tooling automate checks for me.

            I’ve never been asked to use XML for anything, so I don’t know enough to know you’re genuinely serious about recommending XML Schema.

        3. 9

          Except that, sadly, the tooling is pretty weak.

          I like the language but I don’t like the experience of developing with it. I’ve grown soft after a couple of years of Rust development.

          1. 6

            I don’t know where Rust thinks it’s going, though. I can’t even update to the latest version of Bitwarden_rs because it requires a rust-nightly compiler which won’t build on FreeBSD because it dies with an invalid memory reference

            error: process didn’t exit successfully: /wrkdirs/usr/ports/lang/rust-nightly/work/rustc-nightly-src/build/bootstrap/debug/rustc -vV (signal: 11, SIGSEGV: invalid memory reference)

            1. 5

              That’s Bitwarden_rs’s fault for using nightly, imo.

              Looks like this is bug has already been reported with bitwarden-rs though: https://github.com/dani-garcia/bitwarden_rs/issues/593

              1. 3

                Every non-trivial rust program I’ve tried to use so far requires a nightly compiler. This ecosystem is just a trash fire.

                1. 8

                  I’ve got an 80k+ LOC Rust codebase I work with at Rust that doesn’t use nightly. In fact, we’ve never needed nightly… The program runs on production workloads just fine.

                  1. 12

                    I’m using Rust professionally and I don’t even have a nightly compiler installed on my computer. Almost all Rust large programs I see don’t require nightly compilers. Any that do tend to be OS kernels, with exception of a few web apps like this project that use Rocket, a web framework (with many good alternatives, I might add, not to disparage Rocket) that requires syntax extensions and loudly states it requires nightly Rust (and is planning to target stable Rust next release apparently). People who use nightly are generally already writing something experimental which is explicitly not production-quality, or they’re writing something that’s working towards being ready for an upcoming feature (which allows the ecosystem to develop well in response to ecosystem changes, vs waiting months or years for trickle down as is common in other languages), and they’re targeting what is explicitly an alpha-quality compiler to do so.

                    1. 3

                      People who use nightly are […] and they’re targeting what is explicitly an alpha-quality compiler to do so.

                      Or they just want to write benchmarks ;)

                      1. 7

                        criterion.rs is a better harness and works on stable Rust. I’ve been slowly migrating all my crate benchmarks to it. The only advantage of the built-in harness (other than compile times) is the convenient #[bench] annotation. But criterion will get that too, once custom test framework harnesses are stabilized. See: https://bheisler.github.io/post/criterion-rs-0-3/

                        1. 6

                          …and don’t want to use excellent third party tools that function on stable, like Criterion. ;)

                          I admit, the fact that Criterion works great on stable and the built in cargo bench doesn’t IS pretty dismal.

              2. 3

                Does anyone know if a minimal distribution is available? The smallest I could find is 380 MB, which is even larger than Rust :(

                https://adacore.com/download

                1. 0

                  Rust package is almost 700MB on FreeBSD… how did you find one so small?

                2. 1

                  Not to be dismissive, but isn’t warning about type coercion now in all compilers (at least with -Wall)? I also imagine it’s not so hard to write even more strict linters if the compiler isn’t doing it for you. I’m sure there are other aspects that make Ada appealing but the coercion part doesn’t really make sense from my understanding of modern C compilers.

                  1. 3

                    Ada is great! It’s so much better than C and Pascal… were in 1980!

                    Does it have explicit ownership notation? That’s right, it prevents you from doing a lot of dangerous casts!

                    Does it explicitly annotate side-effects? That’s right, it’s officially accepted by the DoD!

                    Frankly, I liked it better when it was called PL/I.