Starting Ada - It has to work

When you buy a new car you just get in and drive. When you try to set up to program in Ada this doesn’t happen. A am now 2 years in using GNAT Studio, I have 20,000 lines of code to my name so I have persisted and I was not put of by the faults in the compiler which suggest that the concept of Total Quality Management may not be at the heart of Ada. True its better than C or C++ and I spent a lot less time chasing bugs the compiler should have told me about. So over all I like it. At first glance it appears more readable than Rust and it doesn’t get too excited about OO either which really holds back beginners. I need a language I can train people on and not have them crash the code base.

There is some very good material out there supporting Ada and a lot from Ada Core but still trying to get a novice to install the IDE and take their first steps, is a mess. Such a mess that I created www.adaworks.it to try to help others through that mess. Its not that I wanted to start providing Ada services but I usually keep notes by creating websites. I hope the installation help given there is an improvement given that I did it for free and I would rather Ada Core had done it.

Well in the last day I attempted to put GNAT Studio on Fedora 37 and it won’t link libc properly so gives up. I like writing code, not fixing operating systems! Then I learn about this thing Alire and download it, the version for Linux. I get a Zip file with a directory bin and in it a file air of 30.9 MB. Great. So then I click on “Get Started” and rather than “How to install what you just downloaded I get “Why Ada?” Do you know what? If I just downloaded something to use Ada I probably have already made that choice. I look desperately for some instructions and give up. Join this forum. Write this post down to here and then…Ah Oh if I click next at the bottom of the page what will that do? Oh “Hello World” well if I had an IDE running that would be a possibility but eventually I decide to take a look. Oh I read a bit " If you haven’t set it up, you can follow the instructions on the Alire site” What I had to get to page 2 to find this hopeful link. Lets try it. Ah “Installation” I can download the latest release from the GitHub repository. But I thought I just downloaded it. I just want to install it. Oh no:
export PATH=<PATH_TO_EXTRACTED>/bin/:$PATH
it says. Well I don’t know where I should extract it? Is it important where I extract it? What do I care about toolchains I just want a working IDE so I can carry on programming. I hate toolchains I don’t care how it works I just want to write code and get out working executables. If this was an instruction manual well… So how do we get past this sloppy way of working…I guess I just have to spend the next few days guessing my way through this or alternatively give up programming in ada to sit and learn all about linux OS from the ground up. At what level is there a nice clean user interface I can work with. This is real “Glass box” approaches. Here is your new car but before you start it you just need to put on the wheels to some unspecified place. I want to do better than this Ada deserves it. How do we expect to bring people onboard with Ada and talk about mission critical systems development when we can’t even get the most important mission of all working:

  • Mission 1 “Starting”.
  • Mission 2 - Testing the IDE before shipping it, on fresh installed systems.

If lives depended on getting people programming in Ada then we arn’t doing to well. Any ideas, I want to help get this right.
Tom
P.S. www.adaworks.it is served from a server written in Ada by me and serving about 9 other sites. 2 of the sites are active sites using a database written in ada by me. The active pages are generated from Ada written by guess who? Correct. Also served from that site is www.tomdehavas.com all about “Oh god not again. Me” I only tell you this to prove that I have a long history of programming and at least some experience in C, C++ and Ada. So its just that I like working on code not trying to make my tools work.
Well if you have read this far than thanks for listening. Yes I am passionate about Ada to and I am happy to help with getting the entry points improved i.e. these first missions.

Welcome to the forum. I think beginning sometime in the 90s, compilers became synonymous with IDEs, especially if you learned to program on Windows- Visual C++, Borland, Codewarrior, to name a few. In the open source (Linux, GCC, etc) community, compilers and editors are, and have always been, two separate things.

Alire has inherited the open source philosophy. What editor you use isn’t something Alire is concerned with because it’s a build and dependency management tool, not an IDE. You could use GNAT Studio, VS Code, Eclipse, vim, emacs, notepad.exe, Alire does not care.

Your frustration lies with a lack of documentation and maintenance effort to make the user experience of the free GNAT Studio seamless. AdaCore prioritizes this work for their paying customers and it’s not really in their interest to expend resources on supporting every Linux distro unless a customer needs it. We should be grateful that they release anything at all, they’re certainly not obligated to.

Free software means you have the freedom to view, modify, and share it, not that it doesn’t come at a cost. In this case, the cost is convincing others that making Fedora 37 a first class platform for GNAT Studio is important, or spending the time to learn how to do that yourself.

I agree we are very privileged to get lots of things for free but it is in the interests of Ada Core to promote the use of Ada and that means making sure that the entry to ada is easy. Fedora is not an odd or quirky distro. Checking is works on perhaps six distros would be a good thing. Also Ada Core can’t really talk mission critical while GNAT Studio has obvious bugs. Typical of this sloppy approach is that uninitialised variables are not detected if they are executed conditionally. That I bet is not a feature put in for non paying customers. I would be happy to pay 200Eur for a product that saved me these battles but I don’t want to pay 8000Eur per annum for 8 people when I am one person and I have no commercial product yet. However when I do I am pretty depressed about paying that kind of money for this kind of quality. Quality is a principle that runs deep and personally I would rather Ada Core charged an introductory license and cared about quality 100%. Don’t get me wrong they produce some really good stuff, but whats the point in a good ship with a faulty gang plank.

1 Like

And this morning after two days (and sleepless nights) of struggle I find that in order to get GNAT Studio to link, I have to simply delete ld from /opt/GNAT/2021/libexec/gcc/x86_64-pc-linux-gnu/10.3.1/
Now I don’t think that is a Fedora 37 issue because that bad linker will be effecting many people. Now it uses the version of ld that works. I did that work for Ada Core for free! That will improve life for their paying customers. :wink:
Also now I can put a page on www.adaworks.it with the details. So other people might benefit and be able to use Ada.

1 Like

And by the way since I intend to build my new company around Ada, I need Ada programmers. To get Ada programmers I need to be able to point them somewhere where it is easy to get started. When I have Ada programmers and get a team together with a commercial product, I pay Ada Core their commercial license. So a 0 defects policy from the start brings in cash in the end for Ada Core. Zero Defects, it works for cars, why not for software. :slight_smile:
Tom

1 Like

You might need to provide code. This comes down to the compiler and not Gnat Studio. I find Gnat Studio CR to be very good and have only had minor issues:

OS shells python text formatting

Language server very occasionally needs code formatting ran again to shift text back towards the margin.

Waiting for the bundled language server to support 2022 square array brackets.

I have had much bigger problems with STM32 cube MX especially on Linux.

You can set the compiler warning in gnat studio preferences => Ada (from the top of my head). Personally I think they could be less liberal by default but an average C programmer and so programmer would probably disagree despite experienced C programmers often saying turn warnings on. Perhaps new defaults are worth consideration in 2023?

Another option is to use spark bronze mode. Getting spark working on some files and not everywhere can be more involved if working with hardware drivers but is generally a case of just

procedure proven is
with SPARK_Mode
https://docs.adacore.com/spark2014-docs/html/ug/en/usage_scenarios.html

The default is Silver but you only need Bronze for proven initialisation. -mode flag of gnatprove

It doesn’t look like you using the latest Gnat Studio Continuous Release from here?

I also get GNAT with
https://alire.ada.dev

This is the new way

You still need the system gprbuild and Gnat packages for traditional code that is not crated yet.

Which makes me wonder if an alire option could link it’s currently selected gnat toolchain(s) stored in alires cache folder in ~/.config into the system path permanently. It would need root though :thinking:

Tools available for Ada development are progressing year after year but they have not reached the same capabilities and same quality of tools available for some other languages. For example, Intellij and Android Studio are at a stratospheric level compared to GNAT Studio or VSCode. Now, I’ve seen some good progress by AdaCore with the latest GNAT Studio version.

When I compare with Xcode, that buggy environment that I’m forced to use by a $400B/year company, I feel very lucky with GNAT Studio, VSCode and Emacs :slight_smile: AdaCore does not have the same revenues but they do provide a better development environment with a smaller development team.

Joke: try Xcode and your pain will vanish!

3 Likes

I simply installed what I downloaded probably few weeks ago.

Sorry I am talking about installing GNAT Studio :slight_smile:

I downloaded from here Commercial software solutions for Ada, C and C++ | AdaCore
I my primary reason for using GNAT Studio and not just using the gnatmake command is the debugger. Command line debugging is impossible.

Tom :slight_smile:

Now you’re just trolling.

What exactly do you mean by that!

Hi, I doubt he is trolling. If using GDB, I find its command line interface very unappealing despite using it quite a bit over the years. With that said, his desire to use GNAT Studio is his preference.

1 Like

I would second this. Debugging in Gnat Studio is great. Debugging from the gdb command line is another matter. Doesn’t matter what language, but the support for Ada was not nearly as good as the support for C or C++.

I haven’t written 20,000 lines of Ada code, but that was still enough that I reported 2 or 3 compiler bugs to AdaCore a few years back when I was a member of GAP. After leaving the university, I’ve encountered other bugs, but I don’t recall if I’ve reported them.

Just this past weekend I encountered yet another one: when I tried to compile a program with link-time optimization, the compiler crashed:

during IPA pass: inline
/home/cantanima/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/lib/gcc/x86_64-pc-linux-gnu/11.2.0/adainclude/a-cihama.adb: In function 'day23__state_maps__Oeq__2':
/home/cantanima/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/lib/gcc/x86_64-pc-linux-gnu/11.2.0/adainclude/a-cihama.adb:536:46: internal compiler error: in initialize_inlined_parameters, at tree-inline.c:3638
  536 |       R_Index : constant Hash_Type := Key_Ops.Index (R_HT, L_Node.Key.all);
      |                                              ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /home/cantanima/.config/alire/cache/dependencies/gnat_native_11.2.4_2f37a10b/bin/gcc returned 1 exit status
compilation terminated.

The source line listed is not my code; it’s from Ada.Containers.Indefinite_Hashed_Maps. (Notice that the filename was not helpful: you can decode a-cihama once you know what package it refers to, but if you want to find the file when you know only the package name, good luck.)

I wouldn’t mention this except that this instance is exemplary of my troubles with GNAT or GPS: the bugs I encounter don’t occur because I’m exploring niche corners of the language; they occur with what seems like “ordinary” features*** — link-time optimization, say.

I’ve never encountered this many show-stopping bugs with other languages’ compilers, despite writing a lot more code in C++ and Rust. I think I’ve encountered only one compiler error in over a year of using rustc at my full-time job, whereas Ada is more a passion. I think my occasional encounters with compiler bugs are because GNAT Community is more “bleeding edge”, while the version you pay for is much more stable.

***the one exception to “ordinary” usage I remember dealt with nested for expressions, and I think for expressions were newly implemented in GNAT at the time. Something like this

function has_property ( list : Some_3d_Array ) return boolean is
   (
     for i in 1 .. Some_3d_Array'Range ( 1 ) =>
        for j in 1 .. Some_3d_Array'Range ( 2 ) =>
           for k in 1 .. Some_3d_Array'Range ( 3 ) =>
              verify_property_for ( element )
   );

AdaCore replied to my bug report by confirming it, saying they had fixed it, and adding that it would be available with the next release.

PS In the for expression example above, I think the actual bug occurred when using them to initialize a variable, not when using them as shown above. But I don’t really remember, so the example serves to indicate what I’m talking about.

Yes Rust is calling me. The thing I do like about Ada is I think I can start new people on it more easily than Rust. Rust I think assumes you have experienced the pain of C++ and are now serious about a solution but it doesn’t seem to be inviting new people in the way that Ada could and Python does.

Yes it’s a shame that some people in the Ada world don’t get the quality idea. In fact 95% of the programming world perhaps. I bet they don’t run weekly updates on the air traffic control system or use agile development though I bet some genius will suggest we re-write it in C++. LOL

Tom

What do you mean by “inviting people”? I was reading just the other day that one reason for Rust’s success is that it has a very friendly stance toward newcomers. (I don’t claim this, btw, but that author thought so.)

Rust is pretty easy to start, even with the borrow checker, since for basic programming tasks the compiler is quite good at offering the correct construction. (Something like this: x is the wrong thing to do, but maybe you meant y, and trying y almost always works.) Likewise, cargo is fantastic; I’m not sure it’s the first “Swiss Army Knife” but it’s telling that Alire seems to have taken cargo as its inspiration, and has a ways to go IMHO before it’s at that level. (If Alire devs read this, please don’t misunderstand: thank you I really do love it.)

Once you get past basic tasks, however, you hit its rather steep learning curve. It doesn’t help that Rust’s designers’ decided that “move” should be the default mode for passing parameters, which forces you to litter code with borrow’s (&), clones, .as_owned(), and so forth. I’ve seen developers with years of Rust experience just type code, then go back and fill in & as the compiler directs them; I’ve seen the same people give the wrong answer about the difference between .iter() and .into_iter(); the name gives a hint, but not a good one, and definitely not one that is consistent with other design decisions IMHO.

Likewise, a lot of Rust API’s, including the standard library, feature poor design decisions where you have to borrow a copyable type; for instance:

   if (start .. stop).contains(&5) { ... }

That’s really jarring if you understand what “borrow” and “copyable” mean. Ada gets that right:

   if 5 in start .. stop then ...

To me that suggests making “move” the default was a mistake.

(Unrelated, but why does ada-lang.io’s syntax checker highlight start instead of if in the extract above?)

Again, what do you mean by “quality”? I suspect that Ada people get “quality” quite well, judging by what I read, but also by the language design. I’m not aware of any other mainstream language where you can check static, compile-time contracts for formal correctness (at least in SPARK); from what I read, Eiffel continues to check its contracts only at run-time even though Bertrand Meyer invented the Design-by-Contract method almost 40 years ago.

I agree with the commenter who said that an issue with GNAT is that it is basically an AdaCore product, and as a corporation, AdaCore pays attention to its customers first and foremost. While GNAT has always been open-source, the Community version is not very robust in my experience. Moreover, something about the history of Ada seems to have discouraged the thriving open-source culture that grew up around C, C++, and now Rust. I could be wrong, but I think it’s related to the time it was developed, by whom, and what for, as well as the fact that Ada’s strict testing standard erects a barrier to alternative compilers.

I mentioned cargo above; its effect on helping people use Rust really cannot be overstated. Alire has the potential of doing the same for Ada. When I started with Ada only a few years ago (5-6), I basically had to search the internet for packages; there were a few websites that indexed interesting packages here and there, but they were mostly out of date or maintained by the author of a single package. Alire, like cargo (or Nim’s nimble), makes it much easier.

1 Like

The forum uses highlight.js for syntax highlighting. It’s Ada grammar is pretty unsophisticated, so I’m not surprised that it gets tripped up easily.

Make sure to add ```ada at the beginning of a code block if it’s not detecting the language properly.

The forum has a setting for default language, which I’ve just changed to Ada.