Starting an Ada track

I have given it some thought and I really like more manpower on this especially the build infrastructure. The track: I think it should be modeled near 1:1 to the book ‘Ada as a second language’ bu Norman H. Cohen. The book is an Ada (95) walk through for a programmer familiar with imperative programming. The book has no exercises. Its is the least problem. The track should appeal to the Software Engineer wannabe!

1 Like

Ada: ‘I have heard that kind of talk before, boy!’
lol

1 Like

The picture is (c) Apple

1 Like
2 Likes

I’d be willing to help, too.

Ada is one of my favourite languages, and I would like to see it represented here!

1 Like

Starting a track from scratch is daunting but doable. First suggestion is to build a team. Cobol happened quickly because we had a team. 8th had a considerably smaller team and took ages. If it hadn’t been for @ErikSchierboom i doubt it would have happened at all. Euphoria is going to take some time too. Will i still be sane enough at the end to do SNOBOL4?

I did write some Ada a few years ago.

Make sure someone on the team understands github actions as CI/CD is a requirement.

2 Likes

Hi all. So we’re happy to re-explore the idea of an Ada Track.

Exercism tracks are consistent in terms of the fact they have exercises based on our problem specifications repository. The first thing to do to get a track launched is to implement ~20 exercises. Chapel and Gleam are two good examples of where this has been going on. So @jquorning, we wouldn’t be basing it on that book etc.

The first step is to agree on the Hello World exercise. You can do that here, and once it’s agreed we’ll create a new repo where you can PR it. Every track has a Hello World and they all follow the exact same pattern. You can see the spec here and check any language to see it working. The three things we need agreed as a starting point are an exercise stub, and example file and a test suite. Once you’ve agreed that here, let us know and we’ll create the repo.

Further down the line we’ll then need a test runner and some other stuff, but let’s get towards 20 exercises implemented first :slight_smile:

Thanks!

2 Likes

So, to defuse the whole “blank page” thing, here’s the Hello World from Imperative language — learn.adacore.com

with Ada.Text_IO;

procedure Greet is
begin
   --  Print "Hello, World!" to the screen
   Ada.Text_IO.Put_Line ("Hello, World!");
end Greet;

To make this match the spec we probably want to name it Hello instead of Greet, and it needs to return the string rather than Put_Line it.

What would that look like?

2 Likes

Maybe like this(?):

procedure Hello return String is
begin
   return  "Hello, World!";
end Hello;
1 Like

Sweet!

Okay, so next up… we need some unit tests.

The original issue from when an Ada track was first requested listed GNATtest as a unit testing framework we could use.

Does that sound right, still?

If so, what would a simple test suite look like?

1 Like

Perhaps it’s better to use Ahven unit test library instead of gnattest.

1 Like

I don’t have any context about either. Do you have a sense of pros/cons with respect to our setup at Exercism?

1 Like

Spread pretty thin these days. I might be able to port an exercise or two to help you spin up if you get the track tooling in place, but I can’t really help with maintainership. I used Ada 95 for some systems programming courses at West Point way back when, but I haven’t touched the language since.

One thing to keep in mind is that once this thing it up, people will be requesting mentorship. The track tools also have to be maintained. This is an indefinite open-ended commitment. Getting to 20 exercises with the necessary tooling is just the start.

2 Likes

You may find the makings for a few exercises on Rosettacode.org

1 Like

We need to choose a testing framework if we’re going to move forward with an Ada track.

So far I’ve heard one vote for GNATtest, and one vote for Ahven, but I’ve not yet heard any reasoning around either of the choices.

If it doesn’t matter which we choose, I’m happy to just flip a coin.

Here’s a test suite that uses GNATtest:

with GNATtest; use GNATtest;
with Hello;

procedure Hello_Test is
begin
   Assert.Equal(Hello.Hello, "Hello, World!");
end Hello_Test;

And here’s the equivalent test suite using Ahven:

with Ahven;
with Hello;

procedure Hello_Test is new Test_Unit
  with Procedure => Hello_Test_Case;

procedure Hello_Test_Case is
begin
   Assert.String_Equal(Hello.Hello, "Hello, World!");
end Hello_Test_Case;

Thoughts?

I have no real Ada knowledge, but I prefer the shorter simplicity of GNATtest.

1 Like

AFAIK gnattest doesn’t provides GNATtest package,because it’s a tool, not a library:

gnattest tool is a utility that creates unit-test skeletons as well as a test driver infrastructure (harness).

It uses AUnit in the generated code. Here is example of a test with AUnit (in examples/simple_test/tests/math-test.adb of the repo):

with AUnit.Assertions; use AUnit.Assertions;

package body Math.Test is

   function Name (T : Test) return AUnit.Message_String is
      pragma Unreferenced (T);
   begin
      return AUnit.Format ("Test Math package");
   end Name;

   procedure Run_Test (T : in out Test) is
      pragma Unreferenced (T);
      I1 : constant Int := 5;
      I2 : constant Int := 3;
   begin
      Assert (I1 + I2 = 8, "Incorrect result after addition");
      Assert (I1 - I2 = 2, "Incorrect result after subtraction");
   end Run_Test;

end Math.Test;

I have been taking a look at the Ada track, I’ve already done the “Hello, World” and “Leap” problems, will tackle a test generator next (to read the test cases from the problem specification JSON and generate the unit tests) and probably a test runner after that

3 Likes

In the event that I’m able to contribute, which Ada are you targeting?

I can contribute an exercise or two as well once we figure out the testing framework.