Live data from Hacker News

Giving Ada a Chance

ajxs.me

101–110 of 261 posts

Re: Giving Ada a Chance

#101

I like the "clean feel" of Ada's syntax: it combines the elegance of Python with a bit more structure and does not suffer from Python's significant whitespace issues. The so-called "Ada comb" structure that is used for packages, subprograms, and even declare blocks makes it easy to find what you are looking for because it makes the source code more regular. The "Ada comb" is formed by the shape of the source code wit…

[deleted]

Re: Giving Ada a Chance

#102
post #85

Earlier quoted context omitted.

From my experience, it still gets a lot of use in aerospace and defence companies. Outside of those industries I can't think of people even mentioning it really, but again probably biases abound. Skimming my local jobs list(SE England) I see new listings from both Airbus and BAE Systems looking for Ada developers in the past week.

Yeah but I wonder how much of that is new development or code from the 80s-80s they’re wanting to port to C or C++

Again this personal experience only, but one of the projects I'm linked to is a greenfields Ada project.

However, you'd be correct to say there are an awful lot of multi-decade projects in both the companies I mentioned(and the aerospace/defence in general). For example, last year my main project was work stemming from a design that began in 1997.

Re: Giving Ada a Chance

#103

Earlier quoted context omitted.

I don't think it even needs to be a range, you can index using enums

Well, "range" was not the correct term. What I meant is that you can't treat the source as sparse. You can't skip portions of it. So you can't make an array that only covers every other element of this enumeration: type Colors is (Red, Green, Blue, Black, Gray, White); It has to be a consecutive group of them, taken in order, as the specification of even this enumeration has an ordering to it as far as Ada is concern…

Ada 2012 allows you to define gaps, this is my best example I have available https://github.com/Lucretia/sdlada/blob/master/src/sdl-video...

Re: Giving Ada a Chance

#104
post #83

Earlier quoted context omitted.

type TPerson = record name: string; age: integer; end; TThrteenPersons = array[10..22] of TPerson; procedure Check(const aPerson: TPerson); var vPerson: TThrteenPersons; begin vPerson[11] := aPerson; // this is ok vPerson[1] := aPerson; // this one gives compile error end; alternatively if runtime range checking is on then vPerson[i] = aPerson will raise the exception if i is out of range

Right. I know it works with numeric indexes in Pascal. My point was that (using my previous example) in Ada it works with any discrete type, in that case characters (which are not numbers in disguise in Ada) so I can do this: Histogram : Character_Histogram; ... Histogram['A'] := Histogram['A'] + 1; (Ok, a bit more work because I didn't initialize the histogram to 0.)

Square brackets are coming, so you'd have to use ('A')

Re: Giving Ada a Chance

#105
post #100

Earlier quoted context omitted.

I feel this. My CS program was in Java. After a few years in industry, I believe that CS should start with either C or Scheme. C to teach you about real machines, Scheme to ignore the machine and do math (algorithms).

I get what you're saying, but learning C teaches you about the C memory model instead of "real machines". C was designed for portability across different architectures and, believe it or not, was considered high-level and abstract at one time. But I agree that learning C is valuable because I believe that learning about manual memory management is valuable.

> But I agree that learning C is valuable because I believe that learning about manual memory management is valuable.

You need to do it in Ada too :-)!

Re: Giving Ada a Chance

#106
post #39

> I can’t help but think that complicated programming paradigms would seem more intuitive to beginners if taught through Ada instead of C and its derivative languages, as is common in computer science and engineering faculties worldwide. At my university, the first courses you took in CS used Ada. I think it was a really good choice but I was in the minority I guess because after my year they switched to either using…

A lot of Universities and company's were bribed by Sun to start using Java.

Re: Giving Ada a Chance

#107
post #39

> I can’t help but think that complicated programming paradigms would seem more intuitive to beginners if taught through Ada instead of C and its derivative languages, as is common in computer science and engineering faculties worldwide. At my university, the first courses you took in CS used Ada. I think it was a really good choice but I was in the minority I guess because after my year they switched to either using…

When I went to school the instructor talked a bit about Ada, but as far as I know there weren't any compilers available that mere students could afford. This was in the mid-90s. I remember doing a bit of comparison of the syntax between languages, and Ada's lack of anything like a switch/case statement stood out, but the instructor did talk up the idea that if you could get it to compile it would run in Ada, assuming…

I was at uni in 1995, they used gnat 3.15p.

Re: Giving Ada a Chance

#108
post #89

Earlier quoted context omitted.

I don't know when it was added, but Ada does have a switch/case equivalent construct and I can't imagine it wasn't available early on. case X is when 1 => ...; when 2 => ...; when 3 | 4 | 100 => ... when others => ... end case;

It was always part of the language, http://archive.adaic.com/standards/83lrm/html/lrm-05-04.html...

I have no idea what my professor was on about then. I remember him showing a slide of this ridiculous looking if/then/elseif... chain compared to a C switch statement.

Re: Giving Ada a Chance

#109
post #100

Earlier quoted context omitted.

I feel this. My CS program was in Java. After a few years in industry, I believe that CS should start with either C or Scheme. C to teach you about real machines, Scheme to ignore the machine and do math (algorithms).

I get what you're saying, but learning C teaches you about the C memory model instead of "real machines". C was designed for portability across different architectures and, believe it or not, was considered high-level and abstract at one time. But I agree that learning C is valuable because I believe that learning about manual memory management is valuable.

And that's fair. I tend to view C as high-level assembler which does mean some loss of fidelity from pure assembly. It seems like a case of being "close enough", I suppose, because switching to pure assembly would make it a lot harder to cover the subject matter in a standard semester.

Re: Giving Ada a Chance

#110
post #55
post #3

This was a good read. I instantly recognized the title of the textbook that is mentioned in the blogpost? I own it! Having a background in C, I went back and forth with Ada for years, without really jumping all in. In the last couple years in particular, with the growing popularity of Rust, I started to renew my interest. I'm reminded of a popular reddit thread on r/Ada-- someone called Rust a "toy language", which p…

> I just wonder why Ada didn't get the credit it deserved as being absolutely bulletproof It's not. All languages make trade-offs in the performance-convenience-safety-etc space, and Ada's choice is not "100% safety". It lacks memory safety and has holes in its type system: https://www.enyo.de/fw/notes/ada-type-safety.html

You can write massive programs without a pointer in sight. If you have to import any C, then it's made a lot worse. You're better off doing memory mapped register type stuff in Ada.
Post reply on HN