/r/ada

Photograph via snooOG

Pointers to news, articles, and other items of interest about the Ada programming language.


Pointers to news, articles, and other items of interest about the Ada programming language.


If a submission doesn't show up, please message the moderators to drag it out of the spam queue. We don't want to miss anything!


Want to learn about Ada? Some suggestions:


Thanks! -- The /r/ada moderators

/r/ada

8,896 Subscribers

10

Is it worth learning Ada in 2025?

I'm a uni student currently with not a lot of free time, I've been wanting to make something bigger than my usual python projects, I was thinking of either learning Ada or Java for this. Keep in mind I don't live in the U.S. so getting a job in the defence industry is A LOT harder for me on account of their being so few already.

6 Comments
2024/12/04
08:56 UTC

3

-gnatE dynamic elaboration model

Hi, one program in a book needs the dynamic elaboration model to compile because its elaboration depends on itself or somethin'... I read you need -gnatE. But for the life of me I can't use any switch, whatever I read in the gnat manual only gets me the help menu !!! Same for `gnatmake * -gnatE`

God I hate GNAT, it's the least informative program I use on a daily basis, and gnat --help doesn't even mesh with most, less or any pager, Could be a gcc's issue though.I can't even redirect its output to a file, I had to search through the terminal... Anyway. I'd happy to finally understand how to use switches, any of them ;-)

8 Comments
2024/12/03
00:20 UTC

18

Programming languages used in Aviation

Interesting video discussing Ada's application in aviation:

Video

6 Comments
2024/12/01
16:33 UTC

18

December 2024 What Are You Working On?

Welcome to the monthly r/ada What Are You Working On? post.

Share here what you've worked on during the last month. Anything goes: concepts, change logs, articles, videos, code, commercial products, etc, so long as it's related to Ada. From snippets to theses, from text to video, feel free to let us know what you've done or have ongoing.

Please stay on topic of course--items not related to the Ada programming language will be deleted on sight!

Previous "What Are You Working On" Posts

8 Comments
2024/12/01
00:02 UTC

10

Implementation of Containers library

How is the Ada.Containers library implemented, such that memory is automatically reclaimed when the objects are unreachable? There doesn't seem to be functionality in the Ada language to accommodate this.

7 Comments
2024/11/27
01:04 UTC

14

Has anyone used Ada to write a VM for a programming language?

Like in all languages, I expect it is technically possible, with a tiny example here. Most mainstream VM implementations exploit bit manipulations like pointer tagging for performance or implementation convenience, or do something like computed gotos for faster opcode dispatching.

Can Ada do these, or do them as effectively? Are there any features of Ada that make it especially good or bad for VM implementation? Or are there any flavors of VM that align well with modern Ada? I believe most VMs are implemented in C or C++.

14 Comments
2024/11/26
15:00 UTC

4

"write a package implementing the abstract table operation for a 2-3 tree"

Hi, in a book I have a question in an exercise asking the title. But it's surprising as in so far, assignments are always more specific, and limited. I have a language (English) issue here.

Here's a bigger excerpts:

8. Complete the implementation of the AVL tree package. Use lazy deletion to implement the Delete operation.
9. Write a package implementing the abstract table operations for a 2-3 tree

As you see it's always "complete this", "implement that operation". But this time I'm confused because it's asking for teh "abstract" operations, so I'm not sure it's mentioning the specification or body. Because nothing has been written in the book for B-trees, and I can tell the "table operations" (delete, insert, retrieve) will be significatively different from BSTs, threaded BSTs or other variants I've studied. How should I understand this sentence then ?

3 Comments
2024/11/23
22:26 UTC

3

How to compiler with gnat or gprbuild to target older versions of libc ?

Hi everyone,

I have a program in Ada where I also distribute a compiled binary version of it in Linux.
Usually, I cross-compile on an older machine (typically Ubuntu 18.04 and 20.04) to generate binaries for x86 and aarch64, in order to avoid the issues of linking to a recent libc version (as I asked previously).

However, is there an easy way in GNAT or GPRBuild to sepcify a specific older libc version to link to, instead of relying on an older distro version ?
For instance, something similar to the --target option in gprbuild ?

Thanks.

4 Comments
2024/11/22
10:20 UTC

16

GCC 14.2.0-3 (aarch64)

The distinguishing feature of this release is that it includes version 25.0 of the AdaCore tools (with some minor patches).

0 Comments
2024/11/21
13:10 UTC

22

Zip-Ada version 60

1 Comment
2024/11/21
01:46 UTC

0

Initialisation de variable GtkAda

J'utilise GtkAda pour écrire des IHM avec les widgets.

J'ai la variable suivante

Self : Gtk_Color_Chooser;

Le type Gtk_Color_Chooser est défini comme :

type Gtk_Color_Chooser is new type Glib.Type.GType_Interface;

Et je ne trouve rien de valable sur le type dont Gtk_Color_Chooser est dérivé.

Merci

Ps : GnatStudio est formidable, mais je n comprends vraiment pas du tout pourquoi on peut pas sélectionner, copier / coller avec le clic droit de la souris.. Aller sur "Edit" à chaque fois est quand même .

4 Comments
2024/11/20
16:11 UTC

1

Debugger cannot open files

Hi! Today I tried to use the debugger with this code to better understand how codes works. The only problem is that for some reason, even if the build and run phase works flawlessly, in the debugger I get a lot of red messagges. Can you tell me what's that?

There is no debug information for this frame.
[2024-11-19 11:35:09] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\gcc\ada\rts\argv.c'
There is no debug information for this frame.
[2024-11-19 11:35:45] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:35:45] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:08] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:08] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:08] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:09] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:09] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:09] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:10] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
[2024-11-19 11:36:10] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\x86_64-w64-mingw32\libgcc\..\..\..\src\libgcc\config\i386\cygwin.S'
There is no debug information for this frame.
There is no debug information for this frame.
[2024-11-19 11:36:45] Cannot open file 'C:\aaa\GNAT-FSF-builds\sbx\x86_64-windows64\gcc\build\gcc\ada\rts\final.c'
There is no debug information for this frame.
There is no debug information for this frame.

I installed Alire v2.0.2 , msys2 (during Alire first use) and GNAT Studio Continuous Release 20240506 .

The System Path that I added the following paths (I think I don't even need them all):
C:\Users\Bev\AppData\Local\alire\cache\toolchains\gnat_native_14.2.1_2540cccb\bin
C:\Users\Bev\AppData\Local\alire\cache\toolchains\gprbuild_22.0.1_c842bbc5\bin
C:\Program Files (x86)\GNATSTUDIO\bin
C:\Users\Bev\AppData\Local\alire\cache\msys64

Hope you can help me! Thanks in advance :)

2 Comments
2024/11/19
10:55 UTC

1

Creating an Alire manifest (.toml) after creating an Ada project with GNAT Studio

Hi!
I was wondering if there was a guide or a function in GNAT Studio that does allow to create a .toml file.
Usually that files is created when a project is created with Alire through the init command. But in case you have created the project trough GNAT Studio how do you create that file?

EDIT: Solved thanks to u/jere1227 : "This section has info on how to have Alire add the toml for you. It gives two options based on whether you want to keep the gpr file you currently have or let alire make a new one. https://alire.ada.dev/docs/#migration-of-an-existing-adaspark-project-to-alire "

4 Comments
2024/11/18
14:49 UTC

5

Creating, editing and running within GNAT Studio

Hi, it my first month learning Ada and I have some questions I hope you can answer to.
I installed Alire and GNAT Studio following the guides provided by AdaCore.

1) Is there a way to use only GNAT Studio without the need to open always Alire console? ✓ 

My problem is that now if I simply start GNAT Studio and create a project, this one won't build because GNAT itself doens't have the path configured, and I didn't find a guide to configure it. I cannot even build the project with Alire console because GNAT Studio itself do not create a .toml file so the Alire console its not able to build it.

My only option is to always init the project with alire console, and then edit trough Alire console which open GNAT Stuido so that it gets automatically set to work properly.

EDIT: Thanks to u/max_rez . GNAT Studio expects to find gprbuild and gnat in the PATH environment variable in OS. So to start GNAT Studio with icon, you need to configure PATH in the OS settings. In Linux/Mac OS you could do this by editing ~/.profile, ~/.bashrc or similar files. In Windows you change PATH in the properties. See for example https://www.java.com/en/download/help/path.html

2) Why I cannot access see the files in bin directory and obj directory in GNAT Studio 'Project view' window? ✓ 

I can browse trough the src and config folders and open all the files inside them but I cannot open the other folders. I just see them, and for some reason the have a letter printed on the folder image ('o' on the obj folder and 'e' on the bin folder) while the folders that I can browse do not have any letter printed on the folder image.

EDIT: Thanks to u/max_rez . Solved this by opening the 'Files' window and by checking 'Show all files in any project directory' in the window Configuration panel (the symbol with 3 horizontal lines near the window title)

3) How can I modify the default windows placement in GNAT Studio? ✓ (Solved partially)

For example if I close the 'Locations' window and open the 'OS Shell' window, after I close GNAT Studio it won't remember those action and will open the 'Locations' window again and won't show the 'OS Shell' window.

EDIT : I think that creating a new 'Perspective' trough 'Window' tab can do the trick, but for some reason it does not open the 'OS Shell' window and simply leaves its space empty.

4) Why everytime I simply change the name of a file in GNAT Studio it starts compiling indexing a lot of things automatically?

EDIT: It actually is a GNAT Studio process to keep consistency within the project and with all external projects that are related.

Sorry for my lack of knowledge and incorectness in the questions, hope you can help me :)

6 Comments
2024/11/18
12:05 UTC

1

Ada & ChatGpt

Bonjour,

je découvre ce forum. J'ai débuté avec Ada 83 et j'ai gardé un intérêt personnel et professionnel pour Ada bien que ne codant plus professionnellement depuis plus de 30 ans maintenant. J'ai codé avec plusieurs langages, beaucoup de Basic, du Cobol, Pascal, Modula 2, Ada et du C.

Il y a quelques jours, j'ai demandé à ChatGpt de me proposer une solution codée et aussi de compléter un code que je n'arrivais pas à terminer.

-Il écrit des choses vraiment étranges qui ne sont pas dans le Manuel de Référence.. Pourquoi ? Grammaire trop complexe pour les modèles d'IA actuels ou désintérêt des concepteurs ? Je ne sais pas !

6 Comments
2024/11/17
22:13 UTC

4

in directed graphs, what do weights on both vertices and edges mean, how does that mesh with weighted adjacency matrices ?

Hi, I am on to directed graphs and trees, Software Construction and Data Structures with Ada 95 chapter 10. I'm having a blast so far. I know adjacency matrices, adjacency lists, I read what weighted matrices are, but I have examples of weights on edges. This is the generic profile for a package of normal directed graphs, no weights:

GENERIC
TYPE Vertices IS (<>);
PACKAGE Digraphs_Generic IS

And this is the exercise:

Reimplement the generic digraph package so that it is possible to represent weighted digraphs. In this case, three generic parameters are needed: one for the vertex set, one for the vertex weights, and one for the edge weights.

I don't get what that would mean, or how to code it, I can't find information on weights on both.

15 Comments
2024/11/12
23:14 UTC

22

Newcomer experience to Ada (2024)

First and foremost, this is not meant to be an attack on the language or anything. However, I find Ada very difficult to get into. I might not personally continue to use the language, but for anyone who cares about it, these are my feedback. I am an experienced academic (not industry) programmer who has a lot of systems programming experience with C/C++/Rust, so they will be mentioned.

This is my third time trying to get a good understanding of this prehistoric systems language that seems to be designed towards safety. The first time being an assignment requirement, and the two later tries on my own. At the end, I never got to use all the claimed "good stuff" about Ada.

Syntax

It's different from what I'm used to and is very verbose, but I can get used to that. Definitely no problem with it.

Beginner Documentation

I mainly used AdaCore's documentation. It shares characteristics of many other language documentation, in that it goes through the very basic of syntax and use of some stdlibs, but doesn't touch much on intermediate topics such as design patterns and project organization.

The Lab exercises corresponding to the text are a bit confusing to do. Often times I need a few good reads to figure out which parts I am supposed to modify. Sometimes boilerplate like with Ada.Text_IO is not included, and I need to wonder if I am supposed to add them. When there's an error, sometimes the output diff is difficult to read, especially when newlines are involved.

I think the docs are OK as an introduction, but I wouldn't know how to actually create a project after finishing the course.

Development Environment

The DE doesn't give a good impression.

First, bikeshedding: why are Alire packages called "crates"? Rust calls it that because its build tool is called "cargo". Is Alire just copying the name? ada.dev not having a top level URL also feels amaturish.

Second, the VSCode extension shows an incorrect setup instruction, depending on how Ada is installed. On a system which uses alr to manage Ada installations, it will create a project that by default can't be built, because gprbuild will not be in PATH.

Third, the LSP is very unstable. Every time I press save, it crashes due to memory access error. So much for a safety-oriented language! And this has not changed since at least last year. In addition, at random times, I have to reload the editor for it to pick up changes in the project. Also, I am unsure if it's VSCode's fault, but every time I press Ctrl-Shift-B for tasks, it loads every single language extensions installed, basically forcing me to reload the editor.

And finally, GNAT's error messages are a bit leaky. By which I mean it includes terms that's almost definitely part of the language syntax. I am a compiler person so I can quickly figure it out, but I don't think it's good.

I think the overall developer experience is unacceptable in 2024. If anyone asks why Ada isn't popular, this is probably a big part.

Documentation

I am talking about the API documentations here. My god they are incomplete ad difficult to decipher. Seriously, there aren't even descriptions of what functions do. Am I supposed to buy a copy of the standard or something?

Other Resources

Books are nice to have, but they are mostly geared towards embedded and high security applications. While I sometimes do that, I am more interested in general desktop or cli applications. Resources on those seem to be quite scarce.

And they are really, really expensive. Not something a newcomer would want to buy before committing to a language. My university's library don't even have them for borrow.

C Call

Most of the world is written in C ABI, and most of the things I want to use are not written in Ada. Unfortunately, it's quite a hassle to bind a C library by myself when I am also figuring everything else at the same time. I made a half attempt at binding Raylib before giving up. Even though I generated the first pass using GNAT, fixing up all the name conflicts and weird errors are a lot of work.

I think C call in Ada certainly works, but I wouldn't really want to write all the binding when I am not committed to the language. It's unlike Zig or C++ where I can just include a C header and use its definition seamlessly, or Rust which is so popular that many interesting packages are already binded and maintained.

Anecdotes

I had horror memories working with strings with Ada when I had to use it in an assignment. The standard lib's string handling was horrible. I guess it's still much better than C, but not as good as a modern language like Rust.

75 Comments
2024/11/11
21:58 UTC

12

Best IDE for Ada

Hi! I'm just learning Ada and I installed IntelliJ IDEA with a plugin to make it work with Ada (after installing Alire). The problem is that I had to install a IntelliJ IDEA 2019 version due to the fact that the plugin maintenance was discontinued.
I saw that lot of people suggest Visual Studio, but some friend of mine for some reason don't like it so I'm skeptical.

What's the best option in you opinion? Thank you in advance for you answers

10 Comments
2024/11/09
09:10 UTC

8

Adacore Libadalang

If anyone is using libadalang, I've been unsuccessfully trying to find a way to recursively analyze record types. In other words, from a record definition that has records within it, to go to those record definitions, etc. The problem is that from a record def one can use F_Components to get a Component_List, and from that get component types and declarations, but it seems like there is no way to get to another record_def on a record type. At least I haven't been able to find it. Any help would be appreciated.

3 Comments
2024/11/08
13:49 UTC

12

Recent interest from industry

For those in the Ada industry, has there been an increase in interest in Ada given the pressure from the DoD and US government as a whole to use memory-safe languages?

7 Comments
2024/11/05
23:07 UTC

15

Ada Developer Room at FOSDEM 2025 - deadline Sat 30 Nov 2024

www.cs.kuleuven.be/~dirk/ada-belgium/events/25/250202-fosdem.html

The 12th Ada Developer Room will take place on Sunday morning 2 February 2025. As before it is organized in cooperation with Ada-Belgium and Ada-Europe. The Call for Presentations is now open: deadline is Saturday 30 November 2024.

Do you have a talk you want to give?
Do you have a project you would like to present?
Would you like to get more people involved with your project?
Would you like to share some knowledge and lessons about Ada?

We're inviting proposals related to Ada software development that include a technical oriented discussion. You're not limited to slide presentations. Be creative. Propose something fun to share with people so they might feel some of your enthusiasm for Ada!

Speaking slots are around 20 or 50 minutes, plus 5 or 10 min. Q&A resp. Please provide a title, preferred length, plus an abstract and a short bio similar in style as on the program for previous Ada DevRooms, see www.cs.kuleuven.be/\~dirk/ada-belgium/events/20/200201-fosdem.html and archive.fosdem.org/2022/schedule/track/ada/ for the last in-person and online edition, resp.

Please submit proposals ASAP, and definitely by November 30, 2024. More information is on the Ada-Belgium web-site (see URL above).

We're looking forward to your proposals!

#AdaFOSDEM #AdaDevRoom #AdaProgramming #AdaBelgium #AdaEurope #FOSDEM2025

1 Comment
2024/11/02
15:22 UTC

12

November 2024 What Are You Working On?

Welcome to the monthly r/ada What Are You Working On? post.

Share here what you've worked on during the last month. Anything goes: concepts, change logs, articles, videos, code, commercial products, etc, so long as it's related to Ada. From snippets to theses, from text to video, feel free to let us know what you've done or have ongoing.

Please stay on topic of course--items not related to the Ada programming language will be deleted on sight!

Previous "What Are You Working On" Posts

16 Comments
2024/11/01
00:01 UTC

19

Looking for a Project to Fund or an RFP for a new one

Hello everyone,

I’m sure you’ve seen me around here, learning, asking noob questions, and trying not to be wrong when commenting. You know…. Reddit stuff. I’ve learned a lot of Ada. Deployed some code. Used it when it was ”Had to work”. Wrote a totally unnecessary HAL for a board with an SVD that I didn’t use. Learned to bit bang. Still the vast ocean in front of me appears to be eternally vast. Maybe that’s why I’m still interested.

Well, I made a post not long ago expressing frustration about GPL licenses, AdaCore and small businesses. Turns out, I was just wrong. AdaCore provides most everything a small business (or large business) could need, free of charge. You pay for help and certifications. Everything else is kinda… there. The big response from the community was “find a project and fund that, instead of paying for an AdaCore license you don’t need.” Fair enough. I looked through a bunch projects and I found a lot of work that was finished, perpetual progress, or early ideas.

I want to fund an innovation and something that will genuinely bring people to Ada from C++, Rust, and whatever’s niche this week. I’d like to submit to r/Ada an RFP, a Request for Proposal (but not like real full up proposals).

What idea do you have that you’d like funded? What’s you plan for it? Do you plan to monetize or make it free? Do you have a solid project that you think I didn’t see?

Full disclosure: I own a business that provides Venture Capital and contracts Sweat Equity to small businesses in exchange for opportunity of ROI, be it equity, percentage of profits, whatever works for everyone. This isn’t related to that. This is more like “Who has a solid idea that’s Ada related that I can shove some money into supporting, profitable or not?” If you have a business that you’re trying to start and you need help, I’m interested in that and can help with funding, sales, engineers, attorneys, accountants, whatever. We have all that. Please DM me though so we don’t turn this into shark tank.

Exo

7 Comments
2024/10/31
03:05 UTC

2

Spark access type equality

Hi, I read that testing equality on access types, when neither value is syntactically null (literally written "null"), is not allowed ? I find it strange, what could be wrong with this ? Access values have more information than a memory zone's address, but they come down to this in practice, there is no ambiguity. Any idea ?

5 Comments
2024/10/30
01:29 UTC

6

If expression: else branch that defaults to True.

procedure Main is

FiveIsLessThanZero : Boolean;

begin

FiveIsLessThanZero := (if 5 < 0 then 0 > 5);

Put_Line (FiveIsLessThanZero'Image);

end Main;

And this code prints TRUE. I think that this is not okay... Why not just forbid an incomplete if expression? What do you guys think?

2 Comments
2024/10/29
16:25 UTC

24

Ada DevRoom at FOSDEM 2025

We are pleased to report there will be an Ada Developer Room at FOSDEM 2025, on 2 February 2025 in Brussels, Belgium. CfP will follow shortly. #AdaDevRoom #AdaFOSDEM #AdaProgramming

https://fosdem.org/2025/news/2024-10-28-devrooms-announced/

5 Comments
2024/10/29
09:34 UTC

4

How to get GNATcoll to work on Windows?

Can someone give me instructions on how to install GNATColl on windows? I am getting the error: file "gnatcoll.ads" not found.

This language is very frustrating to get setup with. No wonder it is dying. More friction means less people coming into the ecosystem.

18 Comments
2024/10/26
17:48 UTC

12

Is there any async library like boost Asio for Ada?

I wanna make a tcp server with Ada and was wondering if there was any good async libraries?

15 Comments
2024/10/25
22:14 UTC

Back To Top