Live data from Hacker News

Why Ada Is the Language You Want to Be Programming Your Systems With

hackaday.com

71–80 of 330 posts

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#71

First, this is a great introduction article to Ada. It's a great history lesson, and analysis of where it's used and why. That said, it seems to be arguing for something in a vacuum. Where is the mention of other new programming languages that also fit this category? Where is the mention of Rust? Rust fits all the same requirements: - A general, flexible design that adapts to satisfy the needs of embedded computer ap…

It's incredibly silly to want to insert Rust into every discussion and suggest every article written about something that Rust (sort of) does should mention it. It's not a good look for people not yet into Rust that this stuff is still happening, IMO.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#72
This article promotes a popular misconception of the programming situation for defense projects in the 1970s. There may have been "hundreds of specialized programming languages" in existence that could be used, but just a handful actually predominated. Most aeronautical projects were done in JOVIAL.

I've talked about this history with engineers from the 1960s-70s. They did not regard the introduction of Ada as a good thing. The JOVIAL language had been developed by engineers and modified through experience over several years to become something they were quite happy with. The impetus that led to Ada came from management and implementation was done by academics.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#73
post #68

There is some overlap in the use cases between Ada-in-the-mainstream (which seems to be what the article is suggesting) and Rust. The existence of Rust will make it even harder for Ada to break out of its existing domains. Both seem to have good ecosystems, but quite different. Ada has more high-assurance tooling and practices. Rust has more in terms of packaging and general-purpose high level libraries. With Ada, it…

Having a big ecosystem of libraries is not even close to a big concern when developing critical applications like what Ada seems to be used for.

But it is a concern for bringing Ada into more domains, which seemed like the point of the article.

EDIT: on a second read, it's not clear whether the article is saying we should use Ada the next time we are building a rocket, or the next time we are building an OS.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#74
post #71

First, this is a great introduction article to Ada. It's a great history lesson, and analysis of where it's used and why. That said, it seems to be arguing for something in a vacuum. Where is the mention of other new programming languages that also fit this category? Where is the mention of Rust? Rust fits all the same requirements: - A general, flexible design that adapts to satisfy the needs of embedded computer ap…

It's incredibly silly to want to insert Rust into every discussion and suggest every article written about something that Rust (sort of) does should mention it. It's not a good look for people not yet into Rust that this stuff is still happening, IMO.

In this discussion, Rust is actually relevant, nearest comparison I can think of.

It's not necessarily as much Rust as the desperate need to get something safer than C/C++ without compromising performance and interoperability.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#75
post #55

Earlier quoted context omitted.

Why use floats when you can basically have doubles for the same cost? Floats tend to cause nasty surprises when you deal with real world units.

Good point. The class definitions can easily be changed from float to double in just a few lines. I used to use a lot of doubles. The I wrote some DirectX and GPUs all use float. I figured if floats are good enough for 3D, they're good enough for me :o)

With floating-point code, you will slowly lose precision in your numbers. (How quickly is a matter of what calculations you're doing, if you're doing them in an error-tolerant manner, and how bad the initial error is in the first place).

Single-precision floating-point starts you off with about 6-7 decimal digits of precision, and the intermediate rounding will mean that you're constantly introducing error in the 7th digit. Computer graphics are pretty tolerant of error--you only need about a 1-2 digits of precision generally--and achieving higher FLOPS is more useful than higher precision. Engineering tolerances are usually going to be tighter, perhaps 4-5 digits for particularly tight tolerances. Furthermore, you're more likely to use nastier equations (logarithms and exponents are particularly bad for precision), so single-precision could well introduce error with real-world consequences.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#76
post #66
post #34

Earlier quoted context omitted.

They started with Ada's syntax and tacked on strange things that do not fit in, e.g., the ".all" in use clauses.

For people wondering what ".all" is about: https://en.wikibooks.org/wiki/Ada_Programming/Types/access

I think he's talking about the use of the all keyword in VHDL. Although, the Ada use is odd too.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#77
post #55

I've developed a set of "strongly typed" classes in C++ that have saved me a ton of grief. Here are some examples. All classes are fundamentally floats. Errors are caught at compilation. cInches i1, i2, i3; cCm cm1, cm2; i1 = 1.f; // error i1 = cInches(1.f); // OK i3 = i1 + i2; // OK cm1 = i1; // error i1 = i2 * 2.f; // OK float f1 = i1 / i2; // OK i1 = i2 * i3; // error! square inches are not inches int add(cInches…

Why use floats when you can basically have doubles for the same cost? Floats tend to cause nasty surprises when you deal with real world units.

> Why use floats when you can basically have doubles for the same cost?

Floats costing the same as doubles is a myth stemming from x87 arithmetic, which is obsolete. On an x64 CPU running 64-bit code, your compiler can often pack four floats into one SSE register. Even when that doesn't happen, CPU microcode can likely do more with floats than with doubles.

Lastly, memory bandwidth usage and cache occupancy doubles, which is true even with x87.

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#78
post #32

> Ada code controls rockets like the Ariane 4 and 5, many satellites, and countless other systems where small glitches can have major consequences. A somewhat amusing endorsement given that the infamous failure of the maiden launch of the Ariane 5 due to series of interconnected software bugs - a reminder perhaps that the choice of implementation language does not automatically make for a reliable system.

105 launches, 2 failures, 3 partial failures. That's a 95,2% success rate.

How many dollars did the failures cost?

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#79
post #59

Earlier quoted context omitted.

That's not really the point I was making. Ada has been around since the 70's and at that time, was possibly the correct choice to make given the criteria. The question I asked at the end, and the title of this article, is why would I pick Ada today? The best reason I've seen is because it's already passed the hurdles in some industries as being a compliant language for their needs. That might be a good enough reason…

That seems like a trick question, because obviously you wouldn't pick Ada, you would pick Rust. And then you would talk about Rust, and mention how great Rust is, perhaps in a thread about Ada, which hadn't mentioned Rust at all. Or a thread about C, or about C++ or even about Go or why not even Python and JavaScript. But seriously now: the author didn't mention Rust because they probably don't even know it exists. I…

I'd really love to read a fair and comprehensive comparison and review of Ada and Rust. Safety, performance, concurrency, low level ABI compatibility etc.

Ada does seem interesting, but all the buzz seems to be about Rust. Perhaps Ada deserves more interest?

Re: Why Ada Is the Language You Want to Be Programming Your Systems With

#80
post #77
post #55

Earlier quoted context omitted.

Why use floats when you can basically have doubles for the same cost? Floats tend to cause nasty surprises when you deal with real world units.

> Why use floats when you can basically have doubles for the same cost? Floats costing the same as doubles is a myth stemming from x87 arithmetic, which is obsolete. On an x64 CPU running 64-bit code, your compiler can often pack four floats into one SSE register. Even when that doesn't happen, CPU microcode can likely do more with floats than with doubles. Lastly, memory bandwidth usage and cache occupancy doubles,…

The difference is meaningless in scalar code. Not everything is or can be vectorized. Pretty much no difference between one double and one float in a SSE XMM register.

> Even when that doesn't happen, CPU microcode can likely do more with floats than with doubles.

I have no idea what that means. As far as I know, there's no CPU microcode dealing with floating point numbers.

> Lastly, memory bandwidth usage and cache occupancy doubles, which is true even with x87.

So use floats when you have a lot of data.

Post reply on HN