Hacker News new | ask | show | jobs
by iiiggglll 3220 days ago
> Even though Apple had not ironed out many of the basics, like how the autonomous systems would work, a team had already started working on an operating system software called CarOS. There was fierce debate about whether it should be programmed using Swift, Apple’s own programming language, or the industry standard, C++.

Wow. Few things guarantee success like starting off a project with a good old-fashioned language flamewar!

5 comments

My guess is it wasn't much of a debate and in actuality they used something like Simulink to model the control system and then had that generate the C++ code for the target hardware. I doubt any car control system software is written by hand these days.
Operating system. Not control system. You don't write an OS in Simulink.
And it didn't settle it - I would love to know if they went for C++. It's getting better and better.

Of course, if they wrote it in Swift 1 they would have had pains migrating to 2 and 3, but if they wrote it in C++ then they wouldn't be able to refactor any of the code as Xcode doesn't support refactoring C++....

I'd say the choice of language you write your OS in is a pretty important one. There should be a fierce debate about such things.
If you're talking about the actual vehicle motion control systems, they probably should have been looking at what languages avionics companies use, not what their app developers are familiar with.

You'll need languages and operating systems that are battle-tested (literally) in hard-real-time fault tolerant systems.

Swift should never have been on the whiteboard for something like that. It's never been used in that scenario.

So what do avionics companies use? C, C++, Ada? Anything else?
Avionics companies have very complex rules. They can use any of the above, but generally a subset.

For example you might use C, but ban malloc, and recursion. There will be static analysis tools that look through your code and calculate exactly how much memory you are using using in the worst case of function call tree, that way they know they cannot run out of memory or stack.

We mostly use C and not C++ in the automotive industry BTW.