Some news about gtk-fortran and AI experiments

I have not much time this autumn to work on gtk-fortran. But I am doing some experiments with IA agents concerning coding. I am using just a free account on Mistral AI (a French company) and most of the time I just use the Chat section because the number of sessions in the code tool is limited in my free account.

But that tool allowed me to fix quickly three long-standing bugs (2 to 6 years):

AI tools can analyze so quickly so much more documentation, code and issues than me…

A long time ago (1991) I wrote an astronomical ephemerides program in GFA Basic 3.5 on my Atari ST. I first prompted the AI agent to convert it in Rust, and it did it, replacing the GEM windows by SGV files. Then I took the version I had ported to Visual Basic in 1995, whose code I had happily exported in text files, containing the code and also a description of the associated windows. I asked Mistral AI to convert it in modern Fortran using gtk-fortran for the GUI. And it did… Just a few prompts. Just a few other prompts to translate everything in English and polish the display:

Sometimes you can have little troubles. For example, the agent may “thought” logically that the Cairo enums are in the cairo module, but no, in gtk-fortran all enums were put in the gtk module. And no, the GLib module is not glib but g. But prompting the error messages is generally sufficient to go forward.

Four examples are using GtkTreeView via the HL library, but it is deprecated in favor of GtkListView for lists, and GtkColumnView for tabular lists. So I asked to create a new hl_tree.f90 example by an example using GtkColumnView, and obtained it :

689 lines I have no time to dive in and understand. Mistral AI even asked me if I wanted a new module hl_gtkcolumview.f90 to simplify the example… I could cite a few other experiments.

Some things have already been pushed, others will be after review and some won’t. Or maybe in gtk-fortran-extra. I feel that I should keep gtk-fortran simple stupid. There is already more than enough code to maintain (for my little person). I don’t want to inflate the repository. But I think AI agents can be used reasonably, especially to work on long standing problems and hard bugs, and therefore to improve the quality of the project.

And if people need more elaborate functionalities, I know they can do like me and obtain it within a few prompts! Maybe I will add a page in the doc with examples of prompts. Although I am not even sure it is necessary, so powerful are those tools.

Finally, I feel I could lose a lot of time with those tools, creating many things I don’t really need, just because I can create them. I feel it could become addictive. So it seems I need some discipline to concentrate on what I really need and want to make. And think.

Conclusions:

  • AI is really helpful to find subtle bugs, even due to the internals of big external libraries like GTK.
  • AI is good at resurrecting old code and translating it in modern languages, even using external libraries.
  • Pause and think, concentrate on important things. “Careful with That Axe, Eugene”.
  • People can now create gtk-fortran applications easily.
1 Like