I do not know the exact rationale of the Alire devs, but Ada already uses (since 83) the word "package" to indicate a module or namespace, so calling dependencies a "crate" seems to avoid confusion with an Ada "package".
The crates of the community index [1] are somewhat vetted because they are added to the index using a PR on GitHub. You're not required to use these external crates though, you can create your own monorepo if you want.
My personal experience has been that a package manager (for any language) makes it much easier to download and build some project.
There's a decent amount of packages in the Ada standard library, but it's not up to the level of Go's.
Ada has a subset called SPARK for functional specification and static verification, so you can write, and some of the crates are actually written in SPARK.
It's quite fun to write some parts of the code in SPARK and get it to prove it with the gnatprove tool (which you can get with `alr get gnatprove` and run it on your code with `alr gnatprove`).
AdaCore also has a variant of the runtime library for embedded systems that is partially proven with SPARK [2].
This website is just a community effort to modernize parts of the online resources, because many parts like the current Ada Reference Manual look like they're from the 90s.
The text at the bottom says "unless otherwise noted". The .md files for the AARM are autogenerated and it seems the legal + foreword pages are missing. These indeed need to be added. The announcement was done by an external person, but nonetheless thanks for bringing it to our attention. The website is still work in progress and is intended to be handed off to the Ada community.
Arrays in Ada start at the index based on the index type of the array. You can even use an enumeration type as the index:
type Day is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
type Hours is array (Day range <>) of Natural;
V : Hours (Monday .. Friday);
Which index type you should use depends on the problem that you're trying to model. You can find out the lower/higher end of a type/variable with the 'First and 'Last attributes.
IIRC there's an RFC though to force the lower end of the index to a certain value like 1 or any other number/enum.
Wow, I never really looked at Ada code. Been using VHDL for the past 2 years a lot and when I looked at your code I was like: 'huh strange, this looks a lot like VHDL'.
Turns out both were invented by the DoD.
>Due to the Department of Defense requiring as much of the syntax as possible to be based on Ada, in order to avoid re-inventing concepts that had already been thoroughly tested in the development of Ada,[citation needed] VHDL borrows heavily from the Ada programming language in both concept and syntax. - https://en.wikipedia.org/wiki/VHDL
Maybe I should pick up Ada soon. That could be a fun journey! (I really love writing VHDL)
I had a similar problem last month where I needed to compute some results on multiple datasets (with a little bit of concurrency per dataset). In the end I just ported the code to Ada which makes it very easy to create task hierarchies. You can define variables of task types on the 'stack' and the program leaves the enclosing block when the variables can go out of scope after every task has finished. I can now easily put all cores to maximum use. The list comprehensions in Python became a little bit more verbose though because I had to use an older revision (2012) instead of the new 2022 revision.
`delay until` is useful in loops because `delay` sleeps at least the given duration, so you get drift. (You call Clock only once and store it in a variable before the loop and then update it adding the time span each iteration)
In fact std::thread::sleep doesn't exist. There's sleep_for and sleep_until. Time deltas and time points are incompatible at the type level, so you have to do:
GP's snippet was in Rust (not that I know if it's valid Rust code).
However, in C++ std::thread is a class and it does not have a static member function sleep_until. (However, std::this_thread, which is a namespace, does have such a function).
Sorry, but I disagree. Maybe in the 80s when developers were all yelling while coding :p Does this look like cobol to you?
type GUID_String is new String (1 .. 32)
with Dynamic_Predicate => (for all C of GUID_String => C in '0' .. '9' | 'a' .. 'f');
The only thing Ada has in common with cobol is that you can define decimal fixed point types (you specify the number of digits and a delta, which must be a power of 10) [1]
I usually use ordinary fixed point types:
type Axis_Position is delta 2.0 ** (-15) range -1.0 .. 1.0 - 2.0 ** (-15)
with Size => 16;
or (from wayland-ada [2]):
type Fixed is delta 2.0 ** (-8) range -(2.0 ** 23) .. +(2.0 ** 23 - 1.0)
with Small => 2.0 ** (-8),
Size => Integer'Size;
If you want to avoid vulnerabilities and have fun with proving that your code is functionally correct, try the Ada/SPARK interactive tutorials at [1] :)
The crates of the community index [1] are somewhat vetted because they are added to the index using a PR on GitHub. You're not required to use these external crates though, you can create your own monorepo if you want.
My personal experience has been that a package manager (for any language) makes it much easier to download and build some project.
There's a decent amount of packages in the Ada standard library, but it's not up to the level of Go's. Ada has a subset called SPARK for functional specification and static verification, so you can write, and some of the crates are actually written in SPARK.
It's quite fun to write some parts of the code in SPARK and get it to prove it with the gnatprove tool (which you can get with `alr get gnatprove` and run it on your code with `alr gnatprove`).
AdaCore also has a variant of the runtime library for embedded systems that is partially proven with SPARK [2].
[1] https://github.com/alire-project/alire-index [2] https://blog.adacore.com/proving-the-correctness-of-gnat-lig...