So, as I am learning Ada, I started doing some digging.
I wanted to see if I couldn’t write some kind simple program with a terminal user interface.
While searching for this, I came across the binding to curses/ncurses, but I thought, hey, why use a C library for this, when I want it to be Ada?
So I look up the following article on terminal control, and it gives a lot of useful information. A lot of it can actually be done with Ada, until…
I then attempted to implement some of this, but again hit a wall when I reached ioctls
and termios
, which are all C as well.
Hitting my head against the keyboard for a while, the task being way over my head, trying to figure out how these worked, so I could possibly implement a method of doing it with Ada.
This lead me to a-textio.adb
, and eventually some documentation (that I am sorry to say, I forgot to bookmark, but it tells me what it in the source) somewhere that skewed my perspective a bit. It just uses a C interface.
So I can gather that using C is probably the easiest thing to do, seeing how (for me it’s a Linux system) the system one is working on is probably written in C, so most calls would interop with it… But, isn’t it a bit disappointing? I was for some reason, possibly naively, hoping that this could have been done in Ada.
One of the things I have noticed going in to Ada, reading forums and articles, is that for more or less any problem, the answer is “use a binding to some C library”. Doesn’t this somehow take away from the so called safety of using Ada?
My question now is, is it all just a fancy wrapper around C, with hopes that whomever wrote the compiler did their job right when creating the bindings?