News for hackers. Stuff that matters.
Re:Learn C by trimbo on Sunday June 02, 2013 @03:05PM (#5809673)
Well, I actually see that as an advantage vs. placing trust in an abstraction you have no control over that can provide security problems for you. So I guess we'll agree to disagree on this one.

Curious though, in what would you implement the examples I gave?

Re:Learn C by betterunix on Sunday June 02, 2013 @07:16PM (#5810479)
For the first two (nuclear power and JSF) and the car I would probably use a language like SML or Haskell, or perhaps even a language like Coq (where your programs are mathematical proofs of their own correctness). For a Mars rover, probably a core written in the languages above, and then bootstrap Common Lisp on top of that core (the core would control critical things that will not need much room to change, Lisp for various AI related things etc.).

Of course, I am not an expert on the requirements of all those projects. Maybe some fact about functional languages makes them entirely unsuitable. If there is a technical reason why C is being used, I would like to know it; if the reason is just, "Well that's what the libraries are written in, that is what most people know, there was a bunch of legacy code, etc." then it only proves that technical reasons are easily trumped by practical concerns. Like I said earlier, it is hard to get away from the large C and C++ codebase that we have to deal with today, despite all the problems of those languages and despite the widespread availability of better languages.

Re:Learn C by claudius on Sunday June 02, 2013 @03:15PM (#5809706)
The control software for the Ariane rockets is written in Ada, which is apparently meant to be especially ‘secure’/predictable.

And promptly blew up the rocket.

Re:Learn C by ColinWright on Sunday June 02, 2013 @03:27PM (#5809747)
As I understand it, this was in part specifically because they turned off the protection the language provided.
Re:Learn C by gnuvince on Sunday June 02, 2013 @05:02PM (#5810088)
Exactly right.
Re:Learn C by jmilkbal on Sunday June 02, 2013 @05:40PM (#5810210)
They took the code from the Ariane 4 and stuck it on the Ariane 5 assuming all would go fine.

While a famous incident attributed to Ada, I can safely say that C and other popular languages have done far more damage. Even if not in terms of exploding rockets (I don't know), but time lost debugging, fiddling with checks that would be handled in other languages and so forth.

I like to tell people with Ada I can spend my time adding value rather than fighting against the language because of it's minimalism and the bugs that come with that.

Re:Learn C by sigkill on Monday June 03, 2013 @06:32AM (#5812415)
Is Ada worth learning?
Re:Learn C by jmilkbal on Monday June 03, 2013 @11:03AM (#5813667)
It's a very personal decision. :) You're not going to be popular on HN with a language like Ada. You're also probably not going to find a company looking for Ada developers, though I, myself, do Ada work for pay.

The Ada way of doing things really is a whole other world with completely different goals in mind than what fanboys and fangirls (I'm using the term dismissively, but there are real problems with new languages) will tell you about the new language they're using that was thrown together last weekend. Ada, of course, is far from perfect, but the blemishes like unbounded string syntax (I hope to see that fixed next revision! Ada just had a new revision!) are not enough to put me off from all the safety and checking the language does for me.

I must tell you that it was the winner of a DoD contest to create a kind of perfect language. There was a document called the Steelman that outlined everything the DoD's perfectly readable, maintainable, reliable, safe language would look like. Three of the four entries were Pascal-derived, not C!

If there is one thing Ada will do for you, if you let it, is demolish your ego. Every stupid thing you do will be caught by the compiler and you will scorned. The compiler will piss and moan catch all sorts of fantastic errors that you'd have to pop into a debugger for in C. Some folks have this notion that they are infallible, but "to err is human", right? You're welcome to turn off the checks in specific instances or project-wide (if you're nuts), but this isn't me. I'd love to think it is—and I write pretty great Ada these days—and I still don't have the gaul to turn off compiler checks.

Everything isn't a pointer in Ada, we can nest functions. Hell we nest packages and do sorts of things that just don't translate to Java, C++ or C, but now I'm just rambling.

I think Ada is a great choice for anything more than a shell script. Learning it introduces you more to a software engineering mindset because the language is built for software engineering, not hacking something together— though, in time, you will be capable of it. It's not the change of mindset like switching from procedural to functional, but it may be just as enlightening.

Re:Learn C by sigkill on Tuesday June 04, 2013 @07:07AM (#5818689)
Well, since I'm not an American nor living in the US, DoD jobs are out of the question.

Secondly, I am unable to grok functional programming, which is why I quit trying to learn Haskell. I tried, I really tried but there's no way I'm able to wrap my head around functional programming. In my mind, there's a long list with two digits in hex, that the computer iterates as fast as possible. So if Ada is a functional only language that puts the brakes right there. If no, I'd be more than happy to start learning.

Re:Learn C by jmilkbal on Wednesday June 05, 2013 @08:57PM (#5829729)
Ada ain't functional. A soft introduction is John English's Craft of Object-oriented programming. It's online, free, very intuitive and very well written. I usually tell folks to skip over the basics if they know them and work the first half. You're welcome to swing by #ada on Freenode for exceptionally friendly Ada talk. See what you think! I hope to see you on Freenode. :)
Re:Learn C by pjmlp on Monday June 03, 2013 @01:26PM (#5814529)
Once I read a story about a hardcore C developer that was forced to work on an Ada project.

In the beginning she was complaining a lot about the language's verbosity, but with the time she spent on the project she eventually became an Ada advocate! :)

Re:Learn C by jmilkbal on Monday June 03, 2013 @04:53PM (#5815946)
That's a great anecdote. All to often you find when people are forced to do something they hate it no matter what, whether it's deserved or not. I'm guilty of this a bit myself. Ada had a DoD mandate in the 90s which really riled a lot of folks and put them off of the language for good. It's part of the reason Ada has not had more of an impact in our lives. That, and compilers for Ada were much more expensive then as well. For many many years though we've had GNAT, a free software project and GCC frontend. We are truly lucky to have it developed by it's corporate steward which is funded by dual-licensing the compiler for FLOSS and commercial support contracts.