Live data from Hacker News

Introduction to Ada

learn.adacore.com

61–70 of 193 posts

Re: Introduction to Ada

#61
I'd be very interested in someone with substantial experience in Ada/Spark providing some insight:

* Why did Ada not manage to get a significant foothold outside of some small domains?

* What's great, what's not so great about it?

* How "modern" does the language feel, including the tooling, documentation, etc? Specifically Spark 2014. ( I see a LSP server and VSCode plugin, for example)

* Spark2014 seems to be open source, with a GPLv3 license. Is this what most companies use, or are there significant closed source parts that must be bought? Are most companies still on older versions?

* What other languages are most similar?

Re: Introduction to Ada

#62
post #7

Ada is one of those languages that I always wish I had a reason to program in

It was my first language i learned in school... in Radford ( Virginia), before my university switched to Java. ADA was/is popular with defense contractors, so a lot of schools in VA teach it. It is very safe language, being both static typed, and strong typed. It was originally a procedural language, but later they added some OO to it. (to folks that don't know what a imperative language is, think of a language where…

Oh, double-hyphen for comments! So maybe that's where SQL got it's comment style from? I'm not sure which SQL spec defined it and what is its overall availability, but it's defined in DB2 and Oracle SQL languages so I'd say it predates the SQL-1992 standard. I think it's also available in MySQL SQL and pgSQL, with a required space between the dashes and the comment text.

Re: Introduction to Ada

#63

Earlier quoted context omitted.

People need to stop using "wordy" when they mean "readable."

That's not necessarily the same thing though. Verbosity can obscure the information you're trying to gather from the code you're reading. A "can't see the forest for the trees"-kind deal.

I cannot see the source code for the documentation. This happens to me in so many cases. I work with a couple of codebases that have 90% documentation, 10% code. In Ada, code IS the documentation that also can be formally verified. It is wonderful.

Re: Introduction to Ada

#64

Ada is one of those languages that I always wish I had a reason to program in

Man there are so many of those languages for me. A lot of mainstream languages seem to mass-add features, but the two I'd like to see people look at are Ada's type system and Erlang-like native bitstring handling.

And OTP!

Re: Introduction to Ada

#66
Looks like a good tutorial, but it doesn't go into much depth on memory-management. The More About Types section has a little. It mentions that automated reference-counting is available through the GNATCOLL library, which seems to have since been broken apart into three different packages [0], so it now resides in gnatcoll-core [1].

Can anyone comment on memory-management in Ada?

[0] https://github.com/AdaCore/gnatcoll

[1] https://github.com/AdaCore/gnatcoll-core/blob/master/src/gna...

Re: Introduction to Ada

#67

I'd be very interested in someone with substantial experience in Ada/Spark providing some insight: * Why did Ada not manage to get a significant foothold outside of some small domains? * What's great, what's not so great about it? * How "modern" does the language feel, including the tooling, documentation, etc? Specifically Spark 2014. ( I see a LSP server and VSCode plugin, for example) * Spark2014 seems to be open…

I don't know SPARK and haven't touched it, but...I had to learn Ada9X at uni in 1995, I've been using it for the last 15 years and have been on #Ada on Freenode for longer.

1) The creator of #Ada, caracal, once said that when he was in the army, there were two groups of people: i) those who were interested to learn about Ada and ii) those who were totally against it without having seen any of the language at all. The second group were the ones who, when they came around with the green manuals, just refused to even read them.

2) I went back to Ada after burning out in a shitty games company, essentially sitting in a debugger for 19 hours straight isn't good. The only time I have to use a debugger is when using pointers, Ada allows you to avoid pointers for the most part.

Ada's type system, data modelling, it's unparalleled anywhere else ever.

There's not enough people working with Ada in OSS.

It's easy to burn yourself out on a big project sometimes.

3) Very modern, the docs are good, but the tooling is lacking. But then I come from a time of command lines and no package managers.

Re: Introduction to Ada

#68
post #60

Fun fact GNAT (GCC Ada front-end) will use a biased representation for range type when packing tight: with Ada.Text_IO; use Ada.Text_IO; procedure T is type T1 is range 16..19; type T2 is range -7..0; type R is record A : T1; B,C : T2; end record; for R use record A at 0 range 0 .. 1; B at 0 range 2 .. 4; C at 0 range 5 .. 7; end record; X : R := (17,-2,-3); begin Put_Line(X'Size'Image); -- 8 bits end T;

For those not familiar with Ada and bit representations, the compiler is exploiting the fact that types in Ada can have constraints that limit their size.

T1 is a type of integer ranging from 16 to 19 (inclusive). Thus, it can only be four distinct values (16, 17, 18, 19). Two bits is enough to represent these four distinct values and thus the binary representation of the type (in record R) can be reduced to 2 bits.

Re: Introduction to Ada

#69
post #26
post #13

Earlier quoted context omitted.

That was an April Fools' joke.

Seriously, the curly braces are a huge improvement. That's no joke. The "fn" and ":" are good too. I'm less sure about "include", because I doubt Ada does textual inclusion. If it does, then that is good too. Otherwise, better choices might be: using, use, require, requires, depend, depends, external, library, unit, module...

I don't get this whole need to shorten keywords to 2 letters when the IDE will just autocomplete them, it's really stupid.

Re: Introduction to Ada

#70

Looks like a good tutorial, but it doesn't go into much depth on memory-management. The More About Types section has a little. It mentions that automated reference-counting is available through the GNATCOLL library, which seems to have since been broken apart into three different packages [0], so it now resides in gnatcoll-core [1]. Can anyone comment on memory-management in Ada? [0] https://github.com/AdaCore/gnatco…

Hello Max!

We agree that it's a hole in the current curriculum, that we intend to fill at some stage with the advanced lessons.

State of memory management in Ada is:

- You have a lot of facilities to stack allocate/not heap allocate tons of stuff that you would heap allocate in pretty much any other low level languages.

- When that doesn't cover you, in Ada you're basically at the level of C++: You have refcounted pointers, unique pointers (which are enforced via limited types) in GNATCOLL, managed containers in the stdlib, and manual memory management. You have storage pools which, with the 2012 additions, are roughly similar to custom allocators in C++/Rust.

- In SPARK we have ownership pointer that are roughly similar to pointers in Rust: https://blog.adacore.com/using-pointers-in-spark

Anecdotally, I have a friend/colleague working on a fun side project, https://github.com/Roldak/AGC, meant to plug a garbage collector into Ada, since the language is much more amenable to that than C or C++. (completely prototype/for fun project, hence why I'm not including it in the "serious" options at your disposal above)

Post reply on HN