The state of tooling

Hi,

I wrote most of this here, so, you can have the context, but I think the main crux should be mentioned here too.

I think he would still complain even with Ada and as someone who has done this with Ada and found the results to be still a bit painful, I can agree.

The biggest issue is the need to bind to C and the main issue being that C is just painful to use outside of C, but to get good, and I mean “really good” bindings, you need to be able to generate them, due to rapid changes in the libraries, but there’s no good way to generate them.

A good example is a function which takes a double pointer, is it an array or is it filling in an address?

Another is a function which takes a pointer, but in Ada needs to be a generic so that you don’t have to 'Address everything.

And I’ve started a binding generator, but got to the point where I really want templates like StringTemplate4 which would really ideally want runtime reflection to use Ada objects to get data out. I looked at other template libs, they’re not good enough just being file templating libs.

Another issue is adding in Ada code to the generated bindings, simple text inclusion can work, but it’s not great and a programmatic way to add an Ada function would work better, but we don’t have a componentised compiler.

And that is the only way I could create SDLAda bindings the way I have done them by hand, but I can’t keep up with the changes in the original lib and with SDL3 in alpha stages, the changes will continue at a rapid pace. Generation is the only way.

Re SDLAda, I’ve been thinking about removing the controlled objects part and trying to make the binding a variable thin-medium thickness binding. One reason is because underneath there’s a lot of faffing around getting internal pointers to SDL2 objects, and for external libs that use SDL2, like Nuklear for example require access to those. Once UFCS is added OOP won’t really be needed anyway.

And while you can bind as you go for a project, people tend to want full working bindings to do anything, especially game development.

So, one of the things that has been in my mind for a long time is creating a new compiler toolchain, which is a massive undertaking and highly daunting task, at which point I wonder about just creating a new language altogether and there is where the conflict in my head is.

And I would love to be able to work full time on my projects and make a living doing that, but I don’t know if it’s even possible, especially with a new language.

I’m at the rapid prototyping part of that blog and I do think that Ada could enable that easily, with the the right libs.

He’s got a point regarding hot reloading and time travel debugging, I remember seeing that kind of debugging about 20 years ago.

So, he mentions in rust not having things like sdl, cimgui, etc. having given nuklear a bash I can see why, especially for single header c lib crap.

The rust community seems to be way more snobbish than the Ada community get accused of.

2 Likes

I suspect a new language would be an entertaining execute but, honestly, is unlikely to reach widespread use. You’d need a hell of a marketing mind or a department.

Work on Ada toolsets could be powerful. If you document them well and build them in a way that others can look at them and know how to implement and use it, you’d be among the few. Even many AdaCore packages provide a few examples but fail to provide a list of methods or a method tree. There’s rarely “here’s the whole function set that’s available and how to use it” documentation for Ada stuff.

Making an Ada compiler would be pretty sweet. I could get down on that especially if it was an ada compiler written in Ada. Ada wouldn’t suffer from a better IDE than GPS or VSCode. If you’ve ever use PyCharm or CLion, they’re just so stinking smooth and high performing. It’s unreal code completion and error detection. Combine that with a compiler in an installer that’s easy to use, you’d have a product like Anaconda (https://anaconda.com) but for Ada.

That’s what people new to the language need instead of spending hours figuring out how to get compilers linked. CLion does a great job in C and C++ of having things in one nice neat box. AdaCore did ok with GnatStudio but the IDE itself is meh. Remember most people will come from interpreted languages since Python is so stinking popular. Those new to Ada are probably going to be coming from Python and Python is very very well documented and crazy easy to set up. Ada isnt really either of those.

If I were to write an Ada compiler, it would NOT be in Ada; see years of issues building gnat and not just me.

1 Like

What I really like is the solution that Joey Fish mentioned in the telegram channel a while ago:

What I plan with Byron, to solve the bootstrapping issue, is this:

(1) Write and Ada-in-Ada compiler, with modular[able] backends, and [hopefully] SPARK verified;

(2) Write a [seed-]FORTH backend, also verified;

(3) Write a [seed-]FORTH interpreter, also verified;

(4) Compile the source from #1 with the FORTH backend;

(5) Compile the FORTH interpreter with the FORTH backend [this gives a tokenized interpreter];

(6) Now bootstrapping can be done by writing an interpreter for the [seed-]FORTH token-stream which should be about 30 instructions;

(7) #6 can be used to run the full #5;

(8) the #6-on-#5 can then run on the output from #1-on-#2, thus allowing Ada compilation on any system for the price of implementing those 30-ish instructions.

Can you provide a link to that?

I’m well aware of his ideas.

I’d write an Ada compiler in Common Lisp, and a Common Lisp implementation’s core in Ada.

I’d expect the real pains in the ass to be the interfacing with the underlying system that needs to be done for things like tasks, and representation clauses.

1 Like

I actually think that Gnat Srudio is excellent. I tried vscode as I could set documentation style easily but I missed too many Gnat Studio features. I still haven’t worked out how to set documentation style in gnat studio though.

In terms of features it’s amazing. I tried VSCode and went back to GnatStudio. The place it lacks in my opinion is the IDE features. Code completion, hover information, error identification is inconsistent and buggy. Sometimes it’s adamant there’s mistakes or a semicolon that is missing when it’s a super short file and there’s clearly no missing semicolon. Once I restart it, it’s fine but I have to restart the program.

That kind of stuff

hmm, That isn’t my experience in the main. If the code is incorrect like a mismatched procedure name after end then it breaks but I guess there isn’t much to be done about incorrect code analysis. I did think vscodes code completion was better for a minute but then I realised Gnat Studio required ctrl=>space which I found that I prefer because it avoids some issue that I forget the details of. I suppose the line navigation messes up very occasionally and clicking again or rekeying makes it work but it’s not a big deal. I can’t think of much else on Linux atleast.

I’m in windows. Might be that.

I will say, the smallest, most insignificant, but regularly annoys me in the smallest way… if I highlight text and hit “ the highlighted text should be put in quotes.

Well, I was hoping this would trigger a real discussion about the tooling issues we face regarding what I actually said.

Also, here is the video from that loglog games blog post, it really is impressive, although if they used arrays and had bounds checking their contrived example would be different because that bug would’ve been caught.

i was particularly interested to read this section of LogLog’s post:

I’ve often found that being unable to just move on for now and solve my problem and fix it later was what was truly hurting my ability to write good code.

In other languages one can write code with “I can throw this away later” in mind, which I’ve found to be the most useful approach in terms of getting good code. An example being say that I’m implementing a player controller. I just want the player to move and do things, so that I can start building my level and enemies. I don’t need a good controller, I just need it to do things. I can surely delete it and make a better one later. In Rust, sometimes just doing a thing is not possible, because the thing you might need to do is not available in the place where you’re doing the thing, and you end up being made to refactor by the compiler, even if you know the code is mostly throwaway.

This feels like a similar debate in the Zig community, regarding the presence of unused variables while prototyping: cf. this Reddit post and this issue in the zig repo.

So my question would be: To what extent have people here tried to use Ada in dev contexts requiring rapid iteration, i.e. contexts without a clear/well-defined problem to be solved? What were the pros and cons that became apparent? In particular, what were the pain points?

1 Like

That’s a cool feature!
I will add it to LEA (BTW, you can configure GNAT Studio to use LEA as an external editor).

Are you sure those issues are related of the usage of Ada? They look more like related to the complexity of GCC and its configuration (basically, the parts not in Ada).

If you look at a certain small (but growing) Ada compiler completely written in Ada (HAC), building it is never an issue. It’s a question of typing gprbuild -P hac or even gprbuild or (if you don’t like typing) clicking the “build” button in GNAT Studio or the ObjectAda IDE.

2 Likes

It’s both. Needing Ada to compile the Ada compiler is a blocker for people, even when pre-built compilers have been available, people have complained.

It would be interesting to know why they feel blocked.
But I’m afraid some people will complain whatever the implementation language, for different reasons.
If you want to make everybody happy, you won’t begin anything.

I already did, in a previous message, GNAT doesn’t bootstrap itself like other compilers do.

I’m not doing this for anyone other than myself if I do it.

Added: Keypress of double-quote when a selection is active will quote the se… · zertovitch/lea@456349f · GitHub

The addition basically consists of:

    procedure Quote_Selection is
      a_pos : constant Position := Editor.sel_a_last_update_UI;
      z_pos : constant Position := Editor.sel_z_last_update_UI;
    begin
      Editor.Begin_Undo_Action;
      Editor.Insert_Text (z_pos, """");
      Editor.Insert_Text (a_pos, """");
      Editor.Set_Sel (a_pos + 1, z_pos + 1);
      Editor.End_Undo_Action;
    end Quote_Selection;

Thx @Exosvs for the idea!