Starting Ada - It has to work

Ah, I had tried ```Ada and didn’t think to make it lower-case. Thanks!

I believe community edition is only there still to keep some people happy.

If you try alire with Gnat 12 and the latest Gnat Studio Continuous binary release from github then there is a chance that the bug you found has already been fixed.

You could also try out vscode with alire. Not sure it highlights compilation and gnatprove errors or not though.

Hi cantanima,
Your right that rust does “invite people” with the features you mention but also as you later point out there are issues with the way it works that are not particularly “inviting” (quoting myself) to beginners. So you are right I think that the rust compiler really is top “quality”. So Ada is “uninviting” because nobody seems to worry that it takes two days for a person with programming background to figure out they have to delete an obscure file “ld” in order to get things to compile. Yes it’s just the linker, but I never used the linker from the command line and any new persion won’t have the foggiest idea about linkers. Yes if you had the supported version of GNAT Studio you could call and ask for support but I bet the problem is still there in the non-community edition. Also the compiler not spotting use of uninitialised variables when in a conditional statement that is bad quality. Who cares if it’s open source, if my software depended on it I would be out there fixing it.

What I mean by good quality is that when ever a problem is found, be it bugs in the compiler or bugs in the installation instructions or no clear installation instructions, fixing them is a no 1 priority. It seems a shame that AdaCore has time to worry about C++ when it hasn’t finished Ada and made it all work perfectly.

Thanks for your well thought out reply. At the moment I haven’t spent more than a half hour looking at some rust a friend was doing so I really am ignorant regarding rust.

Tom

Hi kevlar700,
I have already pointed out the very serious flaws in the introduction to Alire. If that is representative of the the quality of things to come I am only disappointed! I have no real idea how to install stuff from github pull versions compile the code etc. It is also the case that any person new to computing will be in the same situation. That is why clear introductions are necessary. When I download code for my share trading platform I don’t have to try to sort out badly written instructions. There is also a chance that the bug I found has not been fixed! Given that your using Alire yourself why don’t you check it. At the moment I am trying to work, i.e. write code in ada rather than fight with installations of software that have no decent instructions yet.

All the best

Tom

Hi kevlar700,
Community edition is not just there to keep some people happy any more that Ronald McDonald is. Community edition is a tool that brings a load more people into programming in Ada then might come if it were GNAT on its own. Why is it good for AdaCore if more people are available and programming in Ada? You know why. Of course if AdaCore forget Ada and SPARK then that isn’t important, but I guess with a name like AdaCore it does express a degree of commitment. Its a bit like when Lockheed gives facilities to the local electronics club.

Tom

Hmm, is that legal Ada code? It looks very odd to me. And GNAT agrees with me.

I was in a hurry when I wrote it, so I didn’t check it properly. Assuming the compiler wasn’t crashing on erroneous code (and I’m pretty sure it wasn’t), it would have been something more like this:

   function Has_Property ( List : Some_3d_Array ) return Boolean is
     (
      for all I in Some_3d_Array'Range ( 1 ) =>
          ( for all J in Some_3d_Array'Range ( 2 ) =>
              ( for all K in Some_3d_Array'Range ( 3 ) =>
                    ( Verify_Property_For ( List ( I, J, K ) ) ) ) )
     );

I think I kept the code that crashed the compiler, while commenting it out. I’m not at that machine at the moment, but if you like I will see if I can find it up later.

Found it

Here it is:

Result: Hyperspace(
                         0 .. 0 ,
                         S'First(1) - 1 .. S'Last(1) + 1 ,
                         S'First(2) - 1 .. S'Last(2) + 1 ,
                         S'First(3) - 1 .. S'Last(3) + 1
                        )
              := (
                  0 => (
                        for I in -1 .. S'Last(1) + 1 => (
                           for J in -1 .. S'Last(2) + 1 => (
                              for K in -1 + S'Last(3) + 1 => (
                                 if I = -1 or I = S'Last(1) + 1 then Inactive
                                 elsif J = -1 or J = S'Last(2) + 1 then Inactive
                                 elsif K = -1 or K = S'Last(3) + 1 then Inactive
                                 else S(I,J,K)
                              )
                           )
                        )
                       )
                 );

And according to a comment I had in the code, GNAT would crash with Constraint_Error erroneous memory access

The link I gave was as I said to a binary release on github. No compilation required. I have never hit the issues that you have with vscode Gnat Studio CE or Gnat Studio CR. They just worked on Debian and Gentoo. The readme mentions which Linux is supported in CE.

I do know Rust has had major ownership bypass bugs so I would not agree that the Rust compiler is of higher quality. It is certainly less mature, less specified and less certified. I am also starting to wonder if you are trolling though I suppose your website suggests otherwise. I agree Rusts onboarding is more polished or atleast less fragmented as Ada is in transition. Though I do not believe Rust has it’s own IDE at all. I believe the idea maybe to have alire provide gnat studio. Vscode ada support install is one click.

What happened to “end if;” ?

Here is the contents of the readme and at no point does it mention which Linux distros are supported. It does include some “Platform specific notes”, which is not the same thing. The note about Fedora I wrote and they kindly added, after I pointed out the problem. So are you looking at a different readme? Could you give me a URL? Please Please Please Please Please .

GNAT Community

This contains the GNAT Community edition.

The packages for the native platforms contain:

  • the GNAT compiler toolchain
  • the SPARK Ada verification and prover toolset
  • the Libadalang library
  • the GNAT Studio IDE

The packages for the embedded platforms (ARM and RISC-V) only contain the
GNAT compiler toolchain for that target, so we recommend installing the
native package as well.

Installing

On Windows:

Simply run the .exe and follow the instructions.

On Linux:

You will need to make the package executable before running it. In a command
prompt, execute

 chmod +x path_to_the_package-bin                                           

then execute the package.

Automated installation

To automate the installation, use the scripts provided here:

GitHub - AdaCore/gnat_community_install_script: Script to automate the installation of the GNAT Community Installers

Using

                                                                                                                                        1,14          

To start using the tools in command-line mode, you will need to add

<install_prefix>/bin

to your PATH environment variable. Alternatively, you can simply launch

<install_prefix>/bin/gnatstudio

and GNAT Studio will automatically add itself to the PATH - it will also
find the cross compiler, if you have installed everything in the default
locations. Note that GNAT Studio will add this at the end of the PATH,
meaning that it will find first any other GNAT installations that you
have in your PATH.

Platform-specific notes

== OpenSUSE: use the system ld ==

On OpenSUSE, the ld shipped with GNAT Community is not compatible
with the system libraries: use the system-provided ld instead, by
removing the file

libexec/gcc/x86_64-pc-linux-gnu/8.3.1/ld

from your installation.

== Fedora ==

If developer packages are not yet installed, you might need to
install extra packages, by executing the following in a terminal:

sudo dnf install make
sudo dnf install ncurses-compat-libs

== Flashing to boards on Linux ==

To flash boards (such as the BBC micro:bit board) using the pyocd integration
in GNAT Studio under Linux, you might need privileges to access the USB ports,
without which the flash program will say “No connected boards”.

To do this on Ubuntu, you can do it by creating (as administrator) the file
/etc/udev/rules.d/mbed.rules and add the line:

SUBSYSTEM==“usb”,MODE:=“666”

then restarting the service by doing

sudo udevadm control --reload
sudo udevadm trigger

I didn’t ask for a link to GitHub. I pointed out that the website was a mess in terms of its introduction.

So how about some actual constructive comments instead of what is starting to sound like a rant ?
This is the community edition, so it is up to us to provide what we think is missing for the person coming after us. Perhaps submit a pull request to whatever README you think is appropriate ?

Here, you are focusing on one corner-case issue you have seen (the “ld” issue). There has been similar reports for rustc as well. Any toolchain would have something similar, until someone actually tests on the given platforms and proposes a patch to improve things.

The second issue about uninitialized variables is indeed not handled by GNAT (and it is not part of the Ada standard that a compiler must report that, no more than in C, C++ or most other languages). If you want this in the language, please consider using SPARK. GNAT provides the pragma Uninitialized_Variables and -gnatVa switch to help detect those at runtime. On linux, you can also use tools like address sanitizer and valgrind for this.

The Ada community is way smaller than Rust (and will always be that way). That just means we need to focus our efforts a bit differently. Most of us prefer to spend more time developing libraries (or answering questions on this forum) that people who already have the initial setup can use.

AdaCore is the same here: their customers are companies who have already set things up for their employees, so said employees are more interested in the code itself than on this initial setup. AdaCore is a commercial company, and they will not spend large amount of time for the onboarding of new open-source developers. That’s why they are spending significant resources providing alire, so that the community itself can be in charge here.
I am an AdaCore customer (and former employee). I doubt that their customers are using Alire at all, this really is something for the community.

If the initial onboarding is something important to you (and that’s great !) then by all means move things forward in that area, we’ll all be thankful (and future Ada beginners too).

5 Likes

I have done with www.adaworks.it I would be very happy to help move things forward but I am not the one actually building the thing at the moment or in control of the project. I would like to be more involved. As far as “a rant” yes if people say things about the readme file, they should be true. I strongly support the “no blame culture” of the airline industry. You know, people working together to make something excellent. Not people working to try and explain why it doesn’t need to be excellent. Yes I am focussing on two little missions here. 1. A decent entry path, 2. Decent installation instructions for GNAT Studio.

I always say to people “Praise is goot for my ego but criticism is good for my business” I prefer the latter and I think any company or group that prides itself on the quality of it’s products should also. However in breaking that principle I shall again say how grateful I am to AdaCore for GNAT Studio and for the 99.9% of it that works. I know its hard work to create these things. I am just passionate about getting more people into using Ada instead of python for example.

Perhaps I get ranty when people seem not to care or make excuses about the two highlighted points above. If your more knowledgeable than me on how it all works and I am more knowledgeable on the education side (see tomdehavas.com) then could we collaborate to improve the points I have raised. I’m ready :slight_smile:

Best Wishes

Tom

That’s a conditional expression (ARM 4.5.7)

1 Like

In the link I gave you it says.

“So today we announce the end of the GNAT Community releases with 2021 being the last one.”

Why use old code and why is a github site different to adacore especially for open source. Should adacores site link there…probably but I had seen some push back early on from I think atleast one professor.

WRT the readme. The readme I saw was within the package, something like install and mentioned ubuntu versions. I shall not dig it out (perhaps it has changed) as frankly you are being quite rude.

Fact: fast moving releases of Linux have a habbit of breaking software and requiring maintenance. This is actually making “the year of the linux desktop” less likely.

STM32 and Silabs IDEs are broken on many Linux variants.

I do see what you are getting at in regard to ada-lang.io where it suggests a text editor. Without mentioning or providing links to gnat studio or vscode.

I guess a consensus should be discussed in an issue here.

GitHub - ada-lang-io/ada-lang-io: An Open Source Community site for Ada

ada-lang.io is a community site, if you don’t like how it’s done, it’s one of only two Ada sites I know about that you can send a pull request to update it. This was done because someone lamented losing control of another Ada site. It also looks absolutely fantanstic, thanks to @onox

GNAT Studio is good, but has a lot of non-standard behavior compared to other IDEs. Visual Studio Code is a major one, and it has debugging tools you can hook into executables with appropriate plugins. I tried to add workspace support a while ago, but there were questions about whether or not an additional file was worth it, despite it being one of the most popular IDEs.. Alire probably should also generate a launch.json for running/debugging, but it sounds like that might be being baked into the Ada plugin.

Ada support with the Ada Language Server plugin in VS Code is really good. Maxim, who is(was?) contracting for AdaCore has been doing amazing work on it! I talked about set up with VS Code in my 2022 FOSDEM talk. Most of the 10,000 or so new lines of Ada code I wrote in 2021 and 2022 and my reverse engineering of the ARM formatter into .mdx format were done in VS Code with the Ada Language plugin.

I’ve never gotten the debugger to consistently work with Ada, but I also work 50-60+ hours a week and don’t want to mess around with setup in my hobby time. Honestly, I didn’t really need it, since, well, it’s Ada, if I was having problems it was probably because I didn’t use appropriate derived types or design-by-contract.

Of all of the languages and environments I’ve worked in, “World class IDE” status goes to Rider for C#, and the JetBrains tools in general. Visual Studio for C# is also great, and a strong argument can be made that this is due to CLR, though Ada with interface/implementation separation and a built-in package system from the start should be capable of much the same thing.

Visual Studio for C++ is like having an earth mover to get stuff done and troubleshooting difficult things. The only somewhat niche language which has worked out of the box with debugging and a seamless experience for me is probably F#. Starting from googling “What is F#?” last week, I was looking at a breakpoint in a Hello World in about <5 minutes, and I ported a simple tool of a few hundred lines over to it in about an hour.

Note that Rust works similarly to Alire, it doesn’t install an IDE – it’s a piped bash or powershell command for setup. The Rust plugin for JetBrains is amazing, and super good. Their ecosystem is very polished overall.

Without AdaCore, I highly doubt Ada would be viable today. They’ve poured a lot of resources into the open source community over the last few years. Overall, from the start of using Community Edition, in less than a year, Alire became an incredible element in the Ada workflow. If you’re unhappy with something or see a way it can be improved, the folks working on it and on other parts of the ecosystem have been very welcoming with changes.

6 Likes

As @pyj has already said, the community can contribute to ada-lang.io by submitting a PR on GitHub. In particular the pages in ada-lang-io/docs/learn/getting-started at main · ada-lang-io/ada-lang-io · GitHub could use some editing. Feel free to edit or fill in one of the paragraphs of the pages in the previously mentioned folder. Some of these pages contain draft: true, which is why they don’t show up in the build published on ada-lang.io, but they do exist, and are just waiting for someone like the person reading this to start filling in the blanks :slight_smile:

3 Likes

Sorry to sound rude. It’s not intended.

1 Like

Lots of thoughts from lots of people and I appreciate that. I guess the overall assumption is that anybody entering the Ada world is already familiar with GitHub. This I think is a mistake because if they are they are probably already programming in one language or another. I program first and IDE second. I really have little interest in exploring the programming universe. I like to take a language, in this case Ada and do my stuff with it. I have no idea what ada-lang.io is or wat a PR is. To bring Ada to the front of programming languages we need any potential young programmer writing their first lines of code to write them in Ada. Not Python or C. Ada has a friendly enough syntax. To achieve this means that the entry must be easy. You cannot say "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 for beginners”.
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.

OK that was what I said in the first post. I am not saying there is nothing good in the Ada community and I have acknowledged that AdaCore and a lot of people have done a lot, but a simple entry to the language and an IDE that “just works” are the essential doorways to increasing the popularity of the language.