3 ms·
Yeah, and Ada/SPARK performs those checks people are hyped about (and more) at compile-time! Honestly, Ada does everything those languages do (regarding safety)
by johnisgood 6y ago
Yeah, and Ada/SPARK performs those checks people are hyped about (and more) at compile-time! Honestly, Ada does everything those languages do (regarding safety), and does more and does it better (again, talking about safety and correctness here). If you want evidence, check out my posts:
https://news.ycombinator.com/item?id=19122884 https://news.ycombinator.com/item?id=19122884 (!)
https://news.ycombinator.com/item?id=19245898 https://news.ycombinator.com/item?id=19245898 (!!)
https://news.ycombinator.com/item?id=19274244 https://news.ycombinator.com/item?id=19274244 (!!)
https://news.ycombinator.com/item?id=19274412 https://news.ycombinator.com/item?id=19274412
https://news.ycombinator.com/item?id=19770405 https://news.ycombinator.com/item?id=19770405
https://news.ycombinator.com/item?id=20776296 https://news.ycombinator.com/item?id=20776296
https://news.ycombinator.com/item?id=20934511 https://news.ycombinator.com/item?id=20934511 (!!) [3]
https://news.ycombinator.com/item?id=20939336 https://news.ycombinator.com/item?id=20939336 (!!)
https://news.ycombinator.com/item?id=21286061 https://news.ycombinator.com/item?id=21286061
https://news.ycombinator.com/item?id=21286292 https://news.ycombinator.com/item?id=21286292
https://news.ycombinator.com/item?id=21435869 https://news.ycombinator.com/item?id=21435869 (!)
https://news.ycombinator.com/item?id=23609499 https://news.ycombinator.com/item?id=23609499 (!!)
- steveklabnik 6y agoMost of Rust's checks are at compiletime, and Ada employs runtime checks as well.
- johnisgood 6y agoIt can employ, but you do not have to (you can turn off all runtime checks and use formal verification only, something that Rust cannot do (statically verify correctness the same way you can with SPARK using GNATprove)), it can all be done at compile-time with Ada/SPARK. > These runtime checks[1] are costly, both in terms of program size and execution time. It may be appropriate to remove them if we can statically ensure they aren't needed at runtime, in other words if we can prove that the condition tested for can never occur. > This is where the analysis done by GNATprove comes in. It can be used to demonstrate statically that none of these errors can ever occur at runtime. Specifically, GNATprove logically interprets the meaning of every instruction in the program. Using this interpretation, GNATprove generates a logical formula called a verification condition for each check that would otherwise be required by the Ada (and hence SPARK) language. Additionally, in Ada/SPARK, you can formally verify tasks (concurrency), too: https://docs.adacore.com/spark2014-docs/html/ug/en/source/concurrency.html#preventing-data-races https://docs.adacore.com/spark2014-docs/html/ug/en/source/co.... Moreover: > SPARK builds on the strengths of Ada to provide even more guarantees statically rather than dynamically. As summarized in the following table, Ada provides strict syntax and strong typing at compile time plus dynamic checking of run-time errors and program contracts. SPARK allows such checking to be performed statically. In addition, it enforces the use of a safer language subset and detects data flow errors statically. Contract programming: - Ada: dynamic - SPARK: dynamic / static Run-time errors: - Ada: dynamic - SPARK: dynamic / static Data flow errors: - Ada: - - SPARK: static Strong typing: - Ada: static - SPARK: static Safer language subset: - Ada: - - SPARK: static Strict clear syntax: - Ada: static - SPARK: static Additionally, safe pointers in SPARK: https://blog.adacore.com/using-pointers-in-spark https://blog.adacore.com/using-pointers-in-spark and https://arxiv.org/abs/1710.07047 https://arxiv.org/abs/1710.07047. More information about Get_Line (i.e. even where you would think you cannot go static): https://blog.adacore.com/formal-verification-of-legacy-code https://blog.adacore.com/formal-verification-of-legacy-code. [1] overflow check, index check, range check, divide by zero