65 pages of straightforward translation.
Ada for the C++ and Java Developer [pdf]
41–50 of 72 posts
Re: Ada for the C++ and Java Developer [pdf]
#42One of my favorite features of Ada 2012 are the design-by-contract checks taken from Eiffel[0]: Preconditions: "a condition or predicate that must always be true just prior to the execution of some section of code or before an operation"[1]. It is up to the caller (client) to set up the preconditions and ensure that they are true before calling the code in question. If any preconditions are not met, it is the fault o…
Specifically, do the language semantics allow a mode where these checks can be turned off? Leaving them on all the time can be a huge performance burden, both directly and in the barriers they add to optimization (while there are potential optimization benefits to exploiting the guarantees of contracts, I don’t think as a practical matter they balance out).
But allowing them to be turned off in “release mode” eliminates much of the benefit in all modes: Developers can no longer assume that their code always runs in a context where the contractual guarantees are met, so they have to guard data integrity or safety critical operations dynamically anyway.
Re: Ada for the C++ and Java Developer [pdf]
#43Used in aviation extensively where toy and aspirational languages don't do the job. http://archive.adaic.com/projects/atwork/boeing.html
Re: Ada for the C++ and Java Developer [pdf]
#44One of my favorite features of Ada 2012 are the design-by-contract checks taken from Eiffel[0]: Preconditions: "a condition or predicate that must always be true just prior to the execution of some section of code or before an operation"[1]. It is up to the caller (client) to set up the preconditions and ensure that they are true before calling the code in question. If any preconditions are not met, it is the fault o…
For C you can have a look at Frama-C. [2]
D also has DbC. [3]
In case you can target Windows only, VC++ supports SAL Annotations, while not DbC they help to improve code security
[1] - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p233...
[2] - https://frama-c.com/html/acsl.html
[3] - https://dlang.org/spec/contracts.html
[4] - https://docs.microsoft.com/en-us/cpp/code-quality/using-sal-...
Re: Ada for the C++ and Java Developer [pdf]
#45One of my favorite features of Ada 2012 are the design-by-contract checks taken from Eiffel[0]: Preconditions: "a condition or predicate that must always be true just prior to the execution of some section of code or before an operation"[1]. It is up to the caller (client) to set up the preconditions and ensure that they are true before calling the code in question. If any preconditions are not met, it is the fault o…
The problem I’ve seen with trying to add non-static contracts to performance-sensitive languages has been ideological rather than technical. Specifically, do the language semantics allow a mode where these checks can be turned off? Leaving them on all the time can be a huge performance burden, both directly and in the barriers they add to optimization (while there are potential optimization benefits to exploiting the…
Re: Ada for the C++ and Java Developer [pdf]
#46Re: Ada for the C++ and Java Developer [pdf]
#47If any Ada users are here, I have question on one section: procedure Main is type Distance is new Float; type Area is new Float; D1 : Distance := 2.0; D2 : Distance := 3.0; A : Area; begin D1 := D1 + D2; -- OK D1 := D1 + A; -- NOT OK: incompatible types for "+" operator A := D1 * D2; -- NOT OK: incompatible types for ":=" assignment A := Area (D1 * D2); -- OK end Main; > The predefined Ada rules are not perfect; they…
I am not an Ada expert, but I came up with this. Please notice that the idea here is not to have the compiler do proper dimensional analysis but simply to avoid the default operator overloading of "*" for the Distance type that also returns a Distance value. Nothing very high-level, as we need to explicitly manipulate the single-component records, but it does the job. with Ada.Text_IO; use Ada.Text_IO; procedure Main…
Re: Ada for the C++ and Java Developer [pdf]
#48Ada seems like a really good language. Is there any reason why it isn't more popular?
My personal reasons as someone who has learned the language quite intensively but ultimately decided not to use it: (i) Vendor lock-in and too much future dependence on Adacore (other commercial Ada compilers do not count as alternatives to me because they are super-expensive), (ii) I can't always use the MGPL and would prefer MIT licenses of important Ada packages, (iii) the user community is split in a weird way be…
Re: Ada for the C++ and Java Developer [pdf]
#49And here In thought people were talking about Cardano and IELE...
Why did they name that cryptocurrency "Ada"?