❌ About FreshRSS

Reading view

There are new articles available, click to refresh the page.

Bridge returned error 0! (19713)

Details

Type: HttpException
Code: 0
Message: cURL error Failed to connect to tomekw.com port 443 after 189 ms: Couldn't connect to server: 7 (https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://tomekw.com/feed.xml
File: lib/http.php
Line: 127

Trace

#0 index.php(11): RssBridge->main()
#1 lib/RssBridge.php(113): DisplayAction->execute()
#2 actions/DisplayAction.php(71): DisplayAction->createResponse()
#3 actions/DisplayAction.php(106): FilterBridge->collectData()
#4 bridges/FilterBridge.php(168): FeedExpander->collectExpandableDatas()
#5 lib/FeedExpander.php(88): getContents()
#6 lib/contents.php(67): CurlHttpClient->request()
#7 lib/http.php(127)

Context

Query: action=display&bridge=Filter&url=https://tomekw.com/feed.xml&filter=Ada&filter_type=permit&format=Atom
Version: 2023-09-24
OS: Linux
PHP: 8.2.7

Go back

Frenzie, ORelio

Bridge returned error 500! (19629)

Details

Type: HttpException
Code: 500
Message: https://tomekw.com/feed.xml resulted in 500 Internal Server Error
File: lib/contents.php
Line: 106

Trace

#0 index.php(11): RssBridge->main()
#1 lib/RssBridge.php(113): DisplayAction->execute()
#2 actions/DisplayAction.php(71): DisplayAction->createResponse()
#3 actions/DisplayAction.php(106): FilterBridge->collectData()
#4 bridges/FilterBridge.php(168): FeedExpander->collectExpandableDatas()
#5 lib/FeedExpander.php(88): getContents()
#6 lib/contents.php(106)

Context

Query: action=display&bridge=Filter&url=https://tomekw.com/feed.xml&filter=Ada&filter_type=permit&format=Atom
Version: 2023-09-24
OS: Linux
PHP: 8.2.7

Go back

Frenzie, ORelio

Ada programmers: Stéphane Carrez

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

The previous interview, with Edward Fish, can be found here.

Today we will talk with Stéphane Carrez. You can follow him on Github or on Twitter.

Could you introduce yourself? What’s your background? What do you do?

While at school I created my own Z80 computer, because my father didn’t want to buy one. Instead, he gave me the Zilog datasheets and encouraged me to build one. I started to write the code in Assembly on a paper and I typed the hexadecimal opcodes by hand on the EPROM programmer. It was fun, difficult but I learnt a lot. My father was also a defensor of Ada (retired now), and he also gave me the opportunity to learn Ada83 with the Alsys compiler in 1986.

After being graduated from ISEP in 1990, I worked on an Ada83 program for the French army during my military service. It was challenging due to the lack of access types for functions and procedures (introduced in Ada 95). Ada generic was the solution but there were bugs on the Alsys compiler (and MS-DOS didn’t helped either).

Later I created another computer board based on 68HC11 and to use it I also did a complete port of the GNU compiler, the GNU binutils and the GNU debugger. My work was integrated in the FSF sources in 2000. The GNAT Ada compiler was working! I was able to run a small Ada program that fit in less than 256 bytes!

With the support for interface types in Ada 2005, I realized I won’t be blocked anymore by a number of limitations in Ada 83 and 95. I started to create a complete framework that would allow building web applications by using Java-like design patterns. Since 2009, I’m building the Ada Web Application framework by using my professional experience in developing Java J2EE applications. Java J2EE is slow and bloated but it defines several useful patterns that help in designing servers. I just pick some of them and implement them in Ada.

In 2016, AdaCore released a first version of the Ada Drivers Library and launched the first MakeWithAda competition. I bought an STM32F746 board, played a little with their drivers and I was soon interested in writing an embedded network IPv4 stack to analyse Ethernet packets (this was a part of my work at Bouygues Telecom). EtherScope was born and I won the competion. Since then I participate in the competition in the judging process.

What is the single feature you love the most in Ada?

There is more than one feature I really love. To cite one, I’ll mention the Ada protected types. Having worked on a lot of multi-threaded C++ applications, the Ada protected type provides the best encapsulation to protect concurrent accesses. Writing safe multi-threaded applications is difficult and I’ve seen many developers doing things wrong, including me from time to time. Ada protected type prevents a lot of mistakes.

What is the single feature you dislike the most in Ada?

Strings. Too many types to represent a string, you have to choose one between 9 possible types. And in many cases you have to pick two (String and Unbounded_String) and then fall in the nightmare of continuously converting a string type into another. Java did it better for that matter.

One string type to rule them all.

How do you see the future of Ada?

Difficult. Ada is not an attractive language to newcommers. Our world is an immediate world where people don’t want to spend time. Developers want to write fast and move on. For that matter, Python and JavaScript are more attractive. The counter part is that many developers think short term: write code quickly, see it working (less than more), deliver it or throw it away. Maintenance is out of scope.

Ada is a language for people who think long term. You have to think more about the design of your program. Because Ada defines a lot of constraints this design phase is more complex and can be longer. It does not fit well in our immediate world where you don’t want to think but see the thing run immediately. Of course the benefit is the quality of the final program. This is why the language fits well for long term and big projects.

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

In fact Ada 202X will have many new features that look very promising: parallel loops (AI12-0119-1), Map/Reduce attributes (AI12-0262-1), Bignum packages (AI12-0208-1). To mention one evolution, the new assignment target name described in AI12-0125-3 (@) is nice to simplify constructs where you want to update a value by doing a computation on them.

Instead of:

My_Package.My_Array(I).Field := My_Package.My_Array(I).Field + 1;

write:

My_Package.My_Array(I).Field := @ + 1; 

Now I wish Ada could integrate several features that we see in other languages to simplify the syntax such as:

  • a case statement on strings
  • a finally block statement similar to that of Java
  • the generalization of the dot method call notation.

Ada programmers: Edward Fish

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

The previous interview, with Fabien Chouteau, can be found here.

Today we will talk with Edward Fish. You can follow him on Github or visit his website.

Could you introduce yourself? What’s your background? What do you do?

I’m Edward Fish, my formal educational background is Computer Science with a bit of passion for Software Engineering. I taught myself programming with Turbo Pascal for Windows 1.5, just the compiler and printed documentation back when I was perhaps 12 or so. After that I did a little Delphi 5 and got into college where we did C, C++ and Java — the former two were quite a shock because of how bad these were from a usability and correctness perspective: at least 90% of the segment fault/core dump errors beginning students encountered could have been detected by the compiler given saner language-design.

During this time I developed a bit of a passion for Operating Systems and their design, as well as a dislike for C, Unix, and Linux — the latter because any time I brought up my interest in Operating Systems my fellow-students in the CS program would say “why don’t you just download Linux [and tweak it from there]?”, completely missing the point that I didn’t want to merely “tweak” other source code, be constrained to their design & architectures, or hampered by the implementation-language’s (read C’s) pitfalls — and ended up writing an OS (or rather the beginnings of one), in Borland Pascal 7. I got it to the point where I had screen-display/mode-control, could recognize commands, and then got stumped on memory-management (which I wanted to be available not only to the OS, but programs as well, much like .NET Framework or Java do for their programs) before getting swamped with schoolwork and backburnering the project.

I was introduced to Ada in one single class, Programming Languages, which did a high-level introduction/survey of various languages and instantly felt at-home. It did raise the question as to why a lot of the features aren’t common in more languages: range-types; tasks; generics that can take functions, values, and other generics as parameters — why do so many languages instead opt to copy C and its inherently broken syntax and anemic view of problem-solving? — I still don’t have a real answer to this question, but suspect that it’s because C was easy to implement and basing a language on it allowed a lot of language-designers to skip-over the hard parts… essentially ignoring “Everything should be as simple as it can be but not simpler!” because the superficial solution seems to work; much like trying to use RegEx to parse HTML or CSV.

After getting my degree, most of most of my career has been maintenance, everything from PHP to VB.net to C#, and it’s this experience that made me really appreciate how Ada was designed for both correctness and for maintainability. About a year ago I got onto the ARG and VASG boards, the standardization bodies for respectively Ada and VHDL, albeit as a nonvoting member on both.

Nowadays I’m working for NMSU at the Dunn Solar Telescope at the observatory in Sunspot, NM. The system has everything from a vxWorks running on a Motorola 68k to Solaris running on SPARC and Intel, to Windows 7 and Server 2008, all kind-of organically grown over the course of three or four decades. — Right now I’m doing more IT support than software-development, but I do have the intention of simplifying things into a designed system which Ada plays a big part.

What is the single feature you love the most in Ada?

As some people have answered there’s no single feature — I really like Tasks, the generics, Private types, and Packages… but I suppose a lot of this can be distilled to a single feature: design which values correctness and maintainability.

It’s arguable if that’s a feature of the language though, so I’ll let the readers decide the answer for themselves.

What is the single feature you hate the most in Ada?

If you’re referring to the language itself, then how protected-objects expose implementation within the specification rather than forcing that into the private or body of the protected object.

If you’re referring to the standard-defined/-mandated libraries and such, then the combinatorial explosion of packages due to Character, Wide_Character, Wide_Wide_Character, their respective Strings, and text-handling — I’d really love to condense these down so that e.g. [Wide_[Wide_]]Text_IO were merely instantiations of a single generic package.

How do you see the future of Ada?

I can see it going both ways, though obviously I hope for the good outcome. A lot of the issues can be illustrated by the dominance of the language by AdaCore; on one hand it’s problematic in that they’re ignoring a lot of possibility by marketing to the safety-critical and embedded-systems folks, on the other it’s positive in that there is some corporate sponsorship of the language.

There’s a lot the language offers, and I think that a game-company jumping on the language could dominate the industry on a technical level… or an OS developed in Ada, taking advantage of things like the Task construct — but both of these have other factors that would make-or-break their success: the game-company is going to fail if the games aren’t fun or they treat their customers poorly, even if vastly technically superior; just like the OS will fail if they mindlessly copy existing OS-environments (e.g. rewrite Linux in Ada!) or don’t have user-applications.

There’s also a lot of “chicken-and-the-egg”-style bootstrapping problems that need to be overcome in various ways. Just like the OS example above, or new/better tooling, or a successful game-company, or even getting a new & functional open-source compiler into the environment. It’ll take a lot of work, and perhaps a little luck, but the best possible future of Ada is great… and even a modestly good future is pretty good.

Towards alleviating some of these problems, I am working on re-launching Byron — which is a MIT-licensed Ada compiler written in Ada — after I redo the design-documentation; and I am interested in doing an OS in Ada, and might start a thread to that effect on OS-dev and/or comp.lang.ada if and when I write up a design-document for it.

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

Aside from the stuff already going in like parallel-blocks, parallel-for, and reductions? My own proposal, which is a way to automatically instantiate generics from the parameters of generics — admittedly some of that might be my own pride, but I think the idea could be helpful in allowing tighter, more maintainable code.

It would also be really nice to have a sort of provable, abstract generic whereby [current (and future)] features of the language could be described and verified… but that’s getting into a sort of meta-language rather than the language itself.

Ada programmers: Fabien Chouteau

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

The previous interview, with Olivier Henley, can be found here.

Today we will talk with Fabien Chouteau. You can follow him on Twitter and Github.

Could you introduce yourself? What’s your background? What do you do?

My name is Fabien Chouteau, I am embedded software engineer at AdaCore, hobbyist in electronics, instrument making and woodworking.

After my master degree at EPITA in 2010, I joined AdaCore for a six months internship to develop the support of multicore systems (SMP) in the GNAT Ravenscar run-time. Beside a short introduction at school, this internship was my first experience with Ada.

Since then, my technical work at AdaCore mostly revolves around the GNAT Ravenscar run-time (maintenance, customer support, new features, new hardware platforms, certification activities, etc.) as well as the GNATemulator product which is a CPU simulator based on QEMU.

A couple years ago I started the Ada Drivers Library project, at first it was just a way to have fun with an ARM Cortex-M micro-controller board and see how Ada can be used on such hardware. It became a one stop shop for getting started in embedded Ada programming and sparked many other projects like: blog posts, Certyflie, svd2Ada, AdaCore technical demos, etc.

Around the same time, a group of colleagues and I started an effort inside AdaCore to help the Ada/SPARK community grow, and revive the link between AdaCore and the community. Some of the results of this effort are:

  • Moving many of our projects to GitHub
  • Have a simpler contribution process
  • The Make with Ada programming competition
  • The new interactive learning website: learn.adacore.com

And we have exciting plans for the future. As I said, one of the goals is to revive our link with the community, so don’t hesitate to talk to us and share feedback or ideas.

What is the single feature you love the most in Ada?

Representation clauses. They are a way to precisely describe the hardware representation of types. In particular it can be used to describe memory-mapped registers of hardware devices. As driver developer I am so glad not to use bit masks and shifts to communicate with the memory mapped registers. With representation clauses, Ada provides the safest and most readable hardware/software interface.

What is the single feature you hate the most in Ada?

I would say a feature that is both extremely good but also very annoying for embedded, is that Ada allows functions to return objects of unconstrained types (the size in not known at compile time). This feature is awesome for string manipulation, and it is one of the reasons why you don’t need as much pointers in Ada as you need in other languages. But GNAT implements this with a second call stack. Call stacks are already difficult for users to manage on systems where the resources are limited, because it is not easy to know what the size of the stack should be and because detecting stack overflow is complicated. Having two is twice the pain.

How do you see the future of Ada?

For the industrial side of things, it is safe to say that Ada and SPARK have a long and prosperous future in safety critical domains such as aerospace or railway. It is also interesting to see new domains starting to use Ada and SPARK, for instance for security reasons.

On the community side, my main interest is on embedded so I wish to see more people use Ada for this kind of projects. There is also the Alire package manager project which I think will be a game changer for Ada. You can find many interesting projects here and there, but having all of them in a single place, easy to find, easy to integrate into your own code will boost collaboration within the community.

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

On the real-time/embedded front there is the new profile called Jorvik, it is an evolution of Ravenscar that is less restrictive. One of the differences is that it allows multiple entries on a protected object. For example you can use this to have protected buffers with one entry for producers and one for consumers, which is not possible with Ravenscar. A prototype implementation of Jorvik is already available in the ‘ravenscar-full’ run-times provided with GNAT Pro and GNAT Community.

Ada programmers: Oliver Henley

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

The previous interview, with Vinzent Höfler, can be found here.

Today we will talk with Olivier Henley. You can follow him on Twitter and Github. You can check out his awesome-ada repository: a curated list of awesome resources related to the Ada and SPARK programming language.

Could you introduce yourself? What’s your background? What do you do?

I first graduated in Fine Arts but from as long as I can remember I always been attracted by the deep and beautiful implications of rational thinking. In my twenties I started to be interested in creating sculptures using machines. For a while I tried to learn the engineering needed to make robots as an autodidact but then quickly realised I needed proper training to get anywhere serious. I entered engineering school, electrical, and from there felt in love with programming. The depth of the discipline is incredible, you never stop learning fundamental stuff. I feel it always pushes me to better understand the world that surrounds us. To me it is one of the greatest mental exercise one can find.

Before attending engineering school, around 2004, I was working as an alpine ski instructor and learning C by myself using the Beej’s Guide to C Programming. One evening I give a class accompanied by an older, part-time, instructor that designed chips for a UK space company for a living. All proud I tell him about my part-time C autodidact learning. Upfront he said: “Don’t learn C, learn Ada?”. Back home that night, curious, I got informed about Ada on the web but did not found much at the time. I understood the ‘deal’ with Ada but I also felt it was beyond my competencies to really argue a perspective about it against any other programming languages let alone C.

In engineering school, they taught us C++. I first did an internship followed by a full fledge job at Ubisoft Montreal. I developed a patent around the Kinect camera for the game Your Shape: Fitness Evolved; a 3D temporal filter implemented over graphic shaders. Then moved to some R&D, then AAA game productions such as Rainbow Six: Siege, followed by ForHonor. At Ubisoft, everything is C++/C#. These days I work as a software contractor for Autodesk, again full C++.

In my spare time, I work on two distinct personal projects; the details being secrets for the moment. I work with Ada, Golang and Dart.

During the years, the more I learned about software engineering, architectural strategies, optimization etc the more I kept coming back to Ada; in part to see what was their take on these issues but also because other languages always left me frustrated around some quirks elevated to defacto idioms.

Every single time I looked into Ada, I concluded they nailed the right solution. In my view the Ada design team always address core issues and do not give much importance to the ‘sugar’. In the end that’s what you want. By constantly addressing the fundamentals correctly, the language becomes ‘freakingly’ coherent and in turn, powerful. If you think about it, this worths gold. When you learn something in Ada you will almost never get bit by a side effect or an exception to the rule and everything is set in place to achieve correct program without impeding on performances. If you think C++ can be elegant and performant, you have never seen Ada code.

Few engineers from other languages are accustomed to such reality so they often fail to even understand the case for Ada. For them, software crafting is inherently a moving target and they accept all kind of ‘irregular frame of work’ as long as they feel empowered by some tools, syntactic/semantic shortcuts and a perception of novelty; an overall impression that a proper combination of these necessarily leads to a productivity speedup. What most do not realize is that any fundamental flaw or missing fundamental feature in a language will cost you and others tenfold what you might gain from the sum of any programming conveniences.

As an example, why would you even spend time using Python knowing that you’ll eventually hit the Global Interpreter Lock (GIL) and generally poor performances all along? Absolutely no programming sugar will ever compensate the fundamental limitations you locked you in over the long run. It is foolish to think that any ‘serious’ software does not need to be fast and will not eventually need some proper concurrency. In my opinion, all efforts to circumvent these flaws, eg. C core routines glued using Python, shows a tremendous lack of competency, curiosity, and knowledge. This kind of ‘architecture’ has systematically lead to pure extensibility and maintenance hell yet we are still flooded with ads and blog post suggesting to learn and use Python for everything. Since the 80s competent engineers have argued for an objectively better technology, named Ada, and most have ignored them, for dubious reasons, leading us to the mess we are in today.

Other good examples are cURL and OpenSSL. Have you ever wonder how many bugs, problems, headaches, security breaches and man hours would have been saved if those programs were written in Ada from the start? It is not even funny; yet you will find armies of pals ‘a la’ Linus Torvald or Eric S. Raymond, a majority being clueless about how and why Ada would have saved the show for decades now, to defend the C choice.

Ada shines because it is a pioneering low level and mature programming language that, when evaluated over all aspects of programming is still, to this day, the most modern, powerful, productive and advanced language there is. If you disagree or think that I am wrong, it is either because you do not know Ada or because you are not approaching the problem objectively. Ada has no garbage collector, has pointers, is bare metal and therefore exhibit tremendous performance on any platforms, is truly portable, has arguably the most advanced type system, has generics, is build around concurrency, has predictable timing capabilities, has mature tooling, has tons of provision to make huge code bases with complex requirements fly, is easy to learn, write, use, share and deploy. No other languages can claim to offer all that, period.

The typical work flow in Ada generally goes like this. You write the program and work out your solution to make it compile under the Ada ‘boundaries’ (the Ada compiler can be severe for newcomers that tries to code using a C based approach). When it compiles, you already secured a lot; depending on the complexity, often the whole thing is just virtually bug free at this point, hardened already. Then you run, test the program. Now if this soft has to fail it will fail fast; again you are securing great things right away. Ada pushes your program flaws to the surface in such a precise way, eg. compared to C++, it is almost a pleasure to find out about them; messages are concise, meaningful and strict in regard to the ‘coding contract you developed with the language when you first learned it’. The language mechanism and standard libraries exhibits excellency both conceptually and practically which really helps underlining design flaws. Once you revisit and fix the offending parts of your programs, which were in essence always flimsy or plain and simple not properly designed, the whole thing will start to run… and it will not stop. Rapidly your program behaves like an ‘atomic clock’. Writing Ada code feels like playing with this super reliable hifi amplifier made in the 70s that still delivers the best, clean and powerful sound there is even after having been abused for years; you are dragged in ‘deep respect land’. Once you experience what I call the Ada ‘solidity’, other technologies starts to feel like tacky toys … really.

The guys who laid out the Ada foundations were brutally smart. Take C++ global namespaces, named namespaces and anonymous namespaces. Combination of those three often leads to pure abomination in terms of maintenance, integration, compiling, porting, linking, errors reporting etc. These ‘flexible’ C++ features, when deployed in huge and complex software projects become liabilities; they are in fact ‘unstable’ features. In stark contrast, Ada packages are extremely straight shooters. They ‘behave’ correctly all the time, in all context; the thing is simple and just well designed. If the Ada packages piss you off at some point, it’s always for a good reason; you are the “hackery pervert”, not the language. In my experience even if it was sometimes hard to admit, in the end, Ada was always right about my design and bending to its ruling undeniably made my architecture better.

If it was the end of the world and I had to choose a single compiler to get on a machine it would be an Ada one, not because I am blindly sold to the language but because it has shown to me, practically, to be superior in every possible way.

What is the single feature you love the most in Ada?

Not a single feature per se but I would say, its super low level to super high level capabilities wrapped in sound mechanism with virtually no redundancy. Look at any Rosetta Code problem; the Ada solution always shines for its clarity and implicit performance; C/C++ ballpark. It has the approachability of modern scripting languages, flexibility/reach of true bare metal and the maturity of a language ecosystem that kept evolving over many decades; from a time where resources were limited to a time where computing is ubiquitous. Ada is geared towards making applications in a productive, reliable way without wasting CPU cycle. What more would I want?

What is the single feature you hate the most in Ada?

None really. I get there is some annoyances here and there (see Luke A. Guest interview for a comprehensive overview), but I do not consider those fundamental flaws. I am used to deal with way worse. I too, would appreciate a fork, a reboot, without compromises but the politics and the money does not seem to be there. On the other hand Ada is more than good enough, so.

How do you see the future of Ada?

Very bright actually. I think more and more talented people are getting over syntactic sugar, hype, typeless uselessness, bloated abstraction, functional orthodoxy and realize how it adds nothing to ‘real world software’ quality. From that point on Ada will pick up because it has more to offer than anyone can need.

Personally, under comparable effort and tech availability, I do not see why any of my company’s software would not deserve to be built upon what makes airplanes stay in the air and satellites tick. I actually think the best competitive advantage one could get, as we speak, is to build everything in extremely robust and performant, yet productive, fashion; this is exactly what Ada offers you. If I was a big boss I would force everything in Ada because over time building upon previous solid work can only get you lasting results. Do not forget that compared to C++11, Ada 2012 is really easy to learn, use and deploy; I know what I am talking about, I experience both almost every day.

The state of affairs these days in big C++ shops is a bit sad in my opinion; reusability is near zero (with reasons), redundancy is all over, maintenance is a nightmare, most solutions are more complex than they would need to be, velocity is always halted by extremely cryptic ‘legacy bugs’ of all sorts, major refactoring is practically impossible and any prior foundation is shaky or has blurred boundaries more often than not … because of the combination of the previous facts. It’s the ‘hacking culture meets corporations short term objectives and complete disinterest in craft’ crumbling under its own weight in a sense.

I often say to people: “Let’s start to code airplanes in Javascript … Python maybe, no PHP of course!?” to make them realize how absurd the current situation we live in is. I think more and more people starts to draw the same conclusion and/or realise the profound meaning of such problematic postulate. If you ever find yourself fighting your smartphone, your web browser, your OS, look no further; the whole thing has been ‘an almost complete hack’ for over 30 years now. Ada is the low hanging solution and has a proven track record.

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

parallel for … from what I understand it will be there.

Ada programmers: Vinzent Höfler

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

The previous interview, with Patrick Kelly, can be found here.

Could you introduce yourself? What’s your background? What do you do?

My name is Vinzent Höfler, my first programming experience was at the age of 12, when I wrote BASIC programs into a little notebook to be typed in later at the three to four hours a week during which I had access to an actual computer, which was an 8-bit machine, comparable to the C64. Years later I started with Turbo-Pascal on my first owned computer (a used IBM PS/2, with an amazingly fast 16 MHz Intel 386SX processor and whopping 2 megabytes of RAM). Then came the Internet and with it Usenet and newsgroups, and it was around 1996 when a guy whose opinion I valued, mentioned Ada in a discussion thread, so I dug into it. Coming from Pascal, the transition was relatively easy, the language syntax and concepts are similar, but considerably strengthened in Ada. I actually learned the language from reading the reference manual. I tried applying Ada in the job I had at that time, with some success. After a brief interlude at an automotive company where I wrote applications in C for tiny microcontrollers, I got lucky and landed a contract job at the Eurofighter program, which was my first all Ada job. These days I work at Eurocontrol in the team responsible for the tactical flight planning (e.g. ETFMS).

What is the single feature you love the most in Ada?

The type system. First, the ability to declare types which relate to actual things in the real-world instead of just being a machine type. Second, being able to make them distinct types which are not compatible to each other even if they incidentally implemented the same way. You can have a type Altitude, a type Voltage, and a type Light_Year and even though they all may be 32-bit integers, there’s no way to confuse them. Looking at other languages, where I’ve seen functions that take ten parameters of a type int(eger), ask yourself: How do you even ensure that each one gets their correct value? In Ada, these can all be different types and even if they are of the same type, you can use named notation which makes it possible to distinguish.

Also, Ada’s tasking system gets a honorable mention here.

What is the single feature you hate the most in Ada?

Hate is a strong word. There is no single feature I can think of that I actually hate. I have some things I don’t exactly agree with, but most of the time I understand the design decision behind them. Fixed string handling can be cumbersome. Also, I don’t particularly like the notion of having out parameters in function calls, but I acknowledge that the restriction has been rather artificial, anyway; since functions could always have side effects via global variables or could change their parameters by simply giving an “access” to them.

How do you see the future of Ada?

Ok’ish, in a sense. From what I’ve seen, the adoption of Ada has grown slowly, but it is far from what I would wish. It has always been quite strong in the safety critical software development (avionics, railways, etc.), but since Ada2012 introduced pre- and post-conditions into the language, and the SPARK subset for formal proof was revised accordingly, it also seems to gain some traction in the security critical community and I expect that particular interest to grow. We live in a time where virtually every device wants to be connected to the internet software related security issues are still ubiquitous. The adoption of Ada/SPARK would certainly be helpful in alleviating a lot of those. But there seems to be a steep learning curve involved, still many companies don’t even acknowledge that security should be part of their product requirement.

I’d like to see more compilers for Ada, though. If you want to have a compiler for the current language, AdaCore’s GNAT is the only option. There are a few other compiler vendors out there, but to my knowledge, GNAT is the only Ada2012 compiler and will most likely be for the foreseeable future. Luckily, GNAT is part of GCC, so at least in that regard it’s not likely to disappear.

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

Honestly, I actually haven’t really thought about it. I’m quite happy with what we have now. That being said, I look forward to Ada202X, language support for fine grained parallelism is a nice thing to have.

Ada programmers: Patrick Kelly

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

The previous interview, with Luke A. Guest, can be found here.

Today we will talk with Patrick Kelly. You can follow him on Twitter and Github. You can check out his Ada extension for Visual Studio Code and a collection of tooling for Ada projects.

Could you introduce yourself? What’s your background? What do you do?

My name is Patrick Kelly, although I usually go by Entomy in online circles. I’m likely one of the more abnormal programmers, especially in something as formal as Ada, as I have no CS/IT background at all. I don’t have any formal education in CS/IT. I’ve never even taken a class in it. I’ve done work as a nurse, saleman, and cook.

What is the single feature you love the most in Ada?

My single most loved feature of Ada might come as a surprise to others, but it’s not how “safe” the language is. I’m glad it is, but honestly it could be a bit less safe and I’d still be happy. Rather, I go for an odd one: Ada’s finely granular and sophisticated type system. I’ve taken advantage of this to enable or ease all sorts of things that other languages either struggle with or have bizarre syntax to accomplish.

What is the single feature you hate the most in Ada?

As for hate, is the userbase a feature? In all seriousness though, aspects are obnoxiously rigid. We can override Input/Output and Read/Write, but we can’t override Image? Why? For composite types Image is just a function call to the composition of the constituent images. While things like Size or Unchecked_Access should definitely never be overridable, there’s valid reason to override certain aspects. Because of this you have to keep track of which types actually have the Image, or which have a function to do the same and what that function is called. It’s unnecessary developer complexity.

How do you see the future of Ada?

I see it as horrible. Most of the community is blindly full of themselves and it means while things develop nicely for existing Ada developers, very little is actually done to attract new developers to the language. Clearly there is an interest with the explosion of Rust. One of the most important things learned in sales is, obviously, how to sell, and I can safely say Ada isn’t being “sold” well at all, mostly because of a complete lack of understanding or misunderstanding of why people aren’t adopting the language.

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

What I’d most like to see is never going to happen. A complete rewrite of the garbage that is GNAT/GCC-Ada with a toolchain and toolset that isn’t as fragile as sugar glass.

Ada programmers: Luke A. Guest

This is series of interviews with software developers interested in Ada programming language. The goal is to promote the community members and the language itself. Do you want to take part in this? Contact me!

Today we will talk with Luke A. Guest. You can follow him on Twitter and Github.

Could you introduce yourself? What’s your background? What do you do?

My name is Luke A. Guest. I started programming on a ZX Spectrum where I learnt Spectrum BASIC, I later moved onto an Atari ST where I was mainly messing about in STOS BASIC. It wasn’t until getting an Amiga 500+ that I came across a multitasking OS and started using more serious languages.

On the Amiga I learnt m68k assembly in a week and started messing about with the hardware, programming game type things, i.e. getting sprites on the screen and moving them about. Learning about the Copper was really cool, this extra processor with three instructions, which controlled the entire display something I’d never come across before. Other machines of the time either did what they needed with a single external chip, i.e. Spectrum’s ULA, I have no clue what the ST used, but I know it wasn’t anything special, only high-end machines, e.g. SGI, were using custom chips for each part of the hardware.

I can’t remember the timeline exactly, but I did learn C at college on 386’s at the time using Borland’s Turbo C. I was also using AmigaE developing native applications on the OS using the Intuition libray (Amiga’s UI). Even though I’d read that AmigaE had it’s history in Ada, C++ and Lisp, I didn’t really take much notice of the Ada part as I’d never heard of it at that time.

I had a number of Amiga machines, A500+, A1200, A4000 until I finally caved and went PC with Linux as the OS. I’ve been using Linux excusively since the late 1990’s I think. I’ve used various distributions, Red hat, Manjaro, Debian, but finally stuck with Gentoo. I actually had Debian m68k running on my A1200 at uni.

I’m currently not doing any programming work now, but I am looking at getting back into it.

Why did you start using Ada?

We had to learn Ada at uni in 1995, then it was called Ada9X, they said it was going to be called Ada95 eventually. I have no idea how Ada9X from then differs from Ada95 now. I remember liking it, it made sense, but didn’t stick with it at uni after the first year.

I was struggling for work and I ended up at a “games” company, which was a massive mistake, they were completely Microsoft based, using MSVC 6 and Sourcesafe. There were many red flags I should’ve taken note of and left, but I didn’t and I suffered for it, my health has declined massively. We were promised a lot and they never delivered at all.

Initially the projects were in C++, compiles took ages because of templates, even with pre-compiled headers. Intellisense worked for the first week of the project then stopped and would never work again. It messed up formatting all over the place which in turn would make the compiler would complain because of missing braces. Trying to find that was a nightmare, because numerous closing braces were at the same level! You’d have to go and manually format it to find where it was missing a brace. These weren’t small functions either, they were huge that would often go over multiple pages on a 17” monitor. VisualStudio 7 was in alpha at that time and it was really unstable and just not usable.

Another source of frustration were crashes, you could literally spend weeks inside the debugger (which was the only good part of MSVC, BTW) trying to find the error. The error was always a pointer or boundary error, which is the nature of working with such languages.

Due to working there, I burned out badly, I was massively underpaid and overworked (I’m talking 15 hour days at times) and treated like absolute shit, I was barely alive, to be honest.

They forced me out a month before they “went under” only to restart in private, they had the money by that time to do that due to not paying us properly. I decided I wasn’t going back into games ever again and that I was not going to use C or C++ again if I could help it.

At least for my own projects, I didn’t have to use it, I could whatever I wanted. I remembered using a language where I’d never had to touch a debugger with, that was Ada95, and I’ve been with it ever since. Since using Ada, I have had to go into a debugger, but nowhere near as much, but the reason for having to use a debugger? Always pointers, even Ada cannot stop this, but it can help by asserting on the error and giving exact locations of the errors.

I really think Ada is the best programming language for game development, it has all the tools you need built into the language.

What is the single feature you love the most in Ada?

  1. Ranges, being sable to saying a percentage is 0 .. 100 instead of just int, is so powerful.
  2. Attributes, having a type system that can be queried and the results used is amazing.
  3. Modular types, auto-wrapping types are used all the time, but you can easily forget to do it correctly, it’s a simple thing, but at three in the morning it’s not so easy to see an error. In games you want to have some kind of animated sprite, if it’s a loop, you don’t want to be checking which frame you’re on, just increment the frame count, it does it for you!
  4. A real for loop which isn’t dangerous like C’s is, how simple is for Index in -50 .. 75 loop? You cannot go wrong there, you can’t use the wrong symbol and wonder why the final value isn’t being iterated!
  5. Visible blocks using begin..end.
  6. Packages, Ada has many ways to separate code, including separates.
  7. Real generics rather than hacky C++ templates.
  8. Not having to use Main()/main() as your entry point, creating a function or procedure with the name of the application just seems obvious.
  9. Arrays can start anywhere, they can also be indexed by enumerations and characters (which are enumerations).
  10. With representation clauses you can define types with the exact data definition you need without issues 1. You can define this is a higher level, even a lower level language like C can’t get that right.

What is the single feature you hate the most in Ada?

As with the previous list, there’s no one thing:

  1. Strings are a mess.
  2. The ARG doesn’t deprecate parts of the language properly, or at all?? The last time they did a major change was Ada83 -> Ada95, they need to do something like that again.
  3. The language doesn’t evolve fast enough, the ARG is loathe to evolve the language too much as major changes will break compatibility with existing code bases, which is a fair point, but is also a good reason to do it as a new redesigned language.
  4. Ada has been irrationally hated since it’s inception and people hate it without even giving it a chance. Some people look at it and if it doesn’t look like C, they won’t bother, even though it could easily save them hours of debugging time or thousands/millions in financing a project.
  5. IDE integration is non-existent to very basic, a lot of the complaints of Ada being “a pain to write” would be mitigated with auto-completion that works, and with LSP this is just the tip of the ice-berg.
  6. We cannot target iOS at all and Android easily, having an LLVM based compiler would help here.
  7. Monopoly of compilers. Vendors still think it’s right to charge a fortune for access to their compilers, this isn’t the 80’s anymore, people didn’t like it then, they don’t like it now. There could be multiple compiler’s out there and they could’ve been expanded to the new standards quicker if they were open.
  8. Unfortunately, representing endian-ness is a pain in Ada, it’s not easily done and can only really be done with separate implementations for each endian type.
  9. No decent UI libraries are available for the language.

How do you see the future of Ada?

Ada has no future unless more people get on board using it, this means stupid licence games won’t help. A lot of people coming to Ada still think it’s licensed under GPL v3 only, which means your source has to be GPL v3! This is so wrong, only AdaCore’s Community Edition is GPL v3 licensed in this way. If you want your freedom, use the FSF versions from your OS distribution, or MingW if you’re on Windows, or the GNAT from BREW if you’re on Mac OS X.

Take a hint from what happened to Eiffel, if you want a language to grow, it cannot be closed or pay walled.

Ada is still the only properly designed programming language out there. It’s still got things other languages still don’t have or are implementing badly in the runtime or templates, cough C++!

If more people don’t use the language, there will be nobody to take over at the ARG when the inevitable happens. Which means that the language won’t evolve.

Take a look at all the social media sites which have an Ada forum, they apparently list hundreds or thousands of people, yet there’s only really about 5-10 people who ever post. There’s a lot of people, apparently, who could be helping make a decent community, but they’re not. I’ve heard the argument of that they’re under NDA’s, security clearances, etc., but that doesn’t stop you from helping out. Having Ada as only a security language isn’t a good idea, it’s capable of so much more, it is a general purpose language, after all!

We all know Ada 202X is around the corner. What would you like to find in the new release of Ada?

I already know what’s in the specification, it’s an open process, sort of, Ada 2020 Amendment Proposals As of February 11, 2019 and Ada 202x Language Reference Manual - the best new part is the parallel blocks.

I’ve had thoughts of using these parallel blocks for GPU offloading, there’s no reason why we cannot compile Ada to SPIR-V for example:

procedure Do_Something with
  GPU => SPIR_V;

On the whole, the new parts are not enough, they’re only really handling bits of issues people have had with the language, like having a user defined 'Image attribute so you can define one for your new type and output an image which makes sense. Or making certain packages more Unicode friendly.

I would like to see a redesign of the language or a new language which takes the good bits and discards the bad bits. Something that is more rounded, orthogonal and more modern, i.e. Unicode String types done properly, there’s nothing stopping a language supporting extra string types for Latin1, just not 16 and 32 bit versions, use Unicode for that.

Not using 'Image for debugging only, this is currently the only form allowed by the designers of the language, you’re supposed to use the generic packages inside Text_IO if you want more formatting capabilities. Really, they should’ve added more parameters to 'Image to make it better, along with custom image attributes, that would be perfect. Think about all the different text formats in use now, we could easily convert to JSON, TOML, YAML, whatever?

I’m currently interested in pointer-less programming, I had a look through Niklaus Wirth’s Modula specification and they have no pointers there, admittedly this is a language for tiny CPU’s like a Z80, which is fine, but that doesn’t mean it cannot be done, see Java, but make it better. I like the idea of nullable types which can be null, but the language does the tests for you or at least makes it easier, see Zonnon’s nullable types and ? operator.

Working with image data is done all the time, yet you’re forced to do it with a single dimension array; this is also where zero-based array indices really shine, BTW. If you can slice one of those arrays, why not have multi-dimensional array slices? It can be handled by the compiler easily and mapped to calls to memcpy() if that’s how you do it. Say you want to copy a 2D portion of one larger image into it’s own image, having some sort of My_Image (x1 .. x2, y1 .. y2) operation makes so much sense.

Concurrency at a lower level than Ada’s tasks, there’s no reason why you cannot build higher level task like objects, in terms of the lower level concurrency primitives. Any language which boasts concurrency built in now, has to do it better than the rest, so there’s that to cope with also.

One of the complaints against Ada currently is the amount of generics you have to implement to get anything done, a new language has to have this in mind.

We’re not getting away from C or C++ any time soon, so any new language has to support variadic functions, even if it’s just for importing from those languages and restricted so it cannot be used in the new sane language. I’m pretty sure, variadic functions were invented because the C designers didn’t think of allowing overloaded functions, which is the correct way to handle this.

I would even toy with the idea of removing semi-colons, thus possibly attracting Python programmers to the new language.

I would replace begin with do, I think this would help disassociate this new language from Pascal. For some reason, people hate the begin..end, but in Pascal, it’s everywhere, in Ada, it’s not, it’s only statement blocks which have them.


  1. Endian-ness is the only weak part of the representation clause system in Ada. 

Simple blockchain in Ada

I consider myself a late adopter. Everyone talks about blockchain these days. Everyone tries to apply the technology everywhere, even when it does’t make sense. So let’s learn by doing and try to implement the simple blockchain from scratch. And let’s do this in Ada!

Wikipedia defines blockchain as:

A blockchain, originally block chain, is a continuously growing list of records, called blocks, which are linked and secured using cryptography. Each block typically contains a cryptographic hash of the previous block, a timestamp, and transaction data. By design, a blockchain is resistant to modification of the data.

Twitter has a different opinion:

Twitter on Blockchain

So it looks like we have to model:

  • blocks: timestamped records that are able to store some kind of payload
  • a chain of blocks, a.k.a., the blockchain
  • a way to prove the validity of the whole blockchain
  • a proof of work to implement the commit protocol.

Block can be implemented as a new Ada type, Block.Object:

with Ada.Calendar; use Ada.Calendar;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

package Simple_Blockchain.Block is
   type Object is private;
   
   -- public methods omitted for brevity

private

   type Object is
      record
         -- cryptographic hash of the current block
         Hash : String (1 .. 64);
         -- cryptographic hash of the previous block
         Previous_Hash : String (1 .. 64);
         Timestamp : Time;
         -- transaction data payload
         Data : Unbounded_String;
      end record;
end Simple_Blockchain.Block;

The complete, working code can be found at tomekw/simple_blockchain Github repository.

We will create new blocks with a Make function acting as a constructor:

function Make (Previous_Hash : String, Data : String) return Object is
   Now : Time := Clock;
begin
   return (
      -- current hash is a product of new hash attributes
      -- and the whole history of hashes of previous blocks
      Hash => Calculate_Hash (Previous_Hash, Now, Data),
      Previous_Hash => Previous_Hash,
      Timestamp => Now,
      Data => To_Unbounded_String (Data)
   );
end Make;

How do we calculate a hash then?

function Calculate_Hash (Previous_Hash : String; Timestamp : Time; Data : String) return String is
begin
   -- with GNAT.SHA256; use GNAT;
   return SHA256.Digest (Previous_Hash & Image (Timestamp) & Data);
end Calculate_Hash;

We have the blocks but they don’t mean anything without being linked in a chain. A simple blockchain can be stored in a growable vector. Luckily, Ada provides an excellent containers library:

with Ada.Containers.Vectors; use Ada.Containers;

with Simple_Blockchain.Block; use Simple_Blockchain;

package Simple_Blockchain.Blockchain is
   use type Block.Object;

   package Block_Vectors is new Vectors (Index_Type => Positive, Element_Type => Block.Object);

   type Object is private;

   -- public methods omitted for brevity

private

   type Object is
      record
         Blocks : Block_Vectors.Vector;
      end record;
end Simple_Blockchain.Blockchain;

Now, we are able to Append new blocks to the chain:

The_Blockchain : Blockchain.Object := Blockchain.Make;

-- Let's use a string of zeroes as a first hash
First_Hash : String (1 .. 64) := (others => '0');

First_Block : Block.Object := Block.Make (Previous_Hash => First_Hash, Data => "First block");
Second_Block : Block.Object := Block.Make (Previous_Hash => Block.Get_Hash (First_Block), Data => "Second block");

Blockchain.Append (The_Blockchain, First_Block);
Blockchain.Append (The_Blockchain, Second_Block);

How do we know the blockchain is valid?

  1. The stored block hash is the same as the calculated one
  2. The stored previous hash is the same as the hash of the preceding block.

These rules apply to all block in the chain.

function Is_Valid (This : Blockchain.Object) return Boolean is
   Current_Block : Block.Object;
   Next_Block : Block.Object;
begin
   -- iterate over the blockchain in pairs
   for I in Get_Blocks (This).First_Index .. (Get_Blocks (This).Last_Index - 1) loop
      Current_Block := Block_Vectors.Element (Get_Blocks (This), I);
      Next_Block := Block_Vectors.Element (Get_Blocks (This), I + 1);

      -- confirm the stored block hash is the same as the calculated one
      if Block.Get_Hash (Next_Block) /= Block.Calculate_Hash (Block.Get_Previous_Hash (Next_Block), Block.Get_Timestamp (Next_Block), Block.Get_Data (Next_Block)) then
         return False;
      end if;

      -- confirm the stored previous hash is the same as the hash of the preceding block
      if Block.Get_Hash (Current_Block) /= Block.Get_Previous_Hash (Next_Block) then
         return False;
      end if;
   end loop;

   return True;
end Is_Valid;

Our newly created blockchain should be valid:

Blockchain.Is_Valid (The_Blockchain); -- => TRUE

The last part to implement is the proof of work. In the blockchain terminology it’s called mining. Instead of simply appending new blocks to the chain we will mine them. Proof of work will be satisfied as a number of leading zeroes in the block hash defined as a blockchain Difficulty:

procedure Mine_Block (This : in out Blokchain.Object; Data : String) is
   New_Block : Block.Object;
   Previous_Hash : String (1 .. 64);
begin
   if Is_Empty (This) then
      Previous_Hash := (others => '0');
   else
      Previous_Hash := Block.Get_Hash (Last_Block (This));
   end if;

   New_Block := Block.Make (Previous_Hash => Previous_Hash, Data => Data);

   -- the important part: recalculate the hash until it starts
   -- with the expected number of zeroes
   while Block.Get_Hash (New_Block) (1 .. Get_Difficulty (This)) /= Expected_Hash_Prefix (This) loop
      Block.Recalculate_Hash (New_Block);
   end loop;

   Block_Vectors.Append (This.Blocks, New_Block);
end Mine_Block;

Now, instead of appending blocks, it’s possible to simply mine new ones:

Blockchain.Mine_Block (The_Blockchain, "Third block");

Is_Valid function has to be adjusted to take into account the expected hash prefix validation:

function Is_Valid (This : Blockchain.Object) return Boolean is
   Current_Block : Block.Object;
   Next_Block : Block.Object;
begin
   -- code omitted
   
      if Block.Get_Hash (Next_Block) (1.. Get_Difficulty (This)) /= Expected_Hash_Prefix (This) then
         return False;
      end if;

   -- code omitted

   return True;
end Is_Valid;

There is more to the blockchain technolgy than this: sending transactions, wallets, and signatures. However, this post should demistify the concept of blockchains to the reader.

The complete, working code, and a short demo, can be found at tomekw/simple_blockchain Github repository.

with Ada.Text_IO; use Ada.Text_IO;

with Simple_Blockchain.Block;
with Simple_Blockchain.Blockchain;

use Simple_Blockchain;

function Simple_Blockchain_Demo return Integer is
   The_Blockchain : Blockchain.Object := Blockchain.Make (Difficulty => 6);
begin
   Put_Line ("Simple blockchain demo");
   New_Line;

   Put_Line ("Mining first block...");
   Blockchain.Mine_Block (The_Blockchain, Data => "First block");
   Put_Line ("Block mined.");
   New_Line;

   Put_Line ("Mining second block...");
   Blockchain.Mine_Block (The_Blockchain, Data => "Second block");
   Put_Line ("Block mined.");
   New_Line;

   Put_Line ("Mining third block...");
   Blockchain.Mine_Block (The_Blockchain, Data => "Third block");
   Put_Line ("Block mined.");
   New_Line;

   Put_Line ("Is blockchain valid? " & Blockchain.Is_Valid (The_Blockchain)'Image);
   New_Line;

   Put_Line ("Printing blockchain...");
   Put_Line (Blockchain.Image (The_Blockchain));

   return 0;
end Simple_Blockchain_Demo;

Demo output:

Simple blockchain demo

Mining first block...
Block mined.

Mining second block...
Block mined.

Mining third block...
Block mined.

Is blockchain valid? TRUE

Printing blockchain...
Blockchain - difficulty:  6, blocks:  3
Hash: 000000f78298d2028737f802a82edb955e0e4cfdc06b514325da2a037f41b754, Previous hash: 0000000000000000000000000000000000000000000000000000000000000000, Timestamp: 2018-06-14 13:26:11, Nonce:  10942584, Data: First block
Hash: 000000ddfddf305f15fefdada0939139ea33dc94bca1e57eda5f16d902fec55f, Previous hash: 000000f78298d2028737f802a82edb955e0e4cfdc06b514325da2a037f41b754, Timestamp: 2018-06-14 13:26:17, Nonce:  6008350, Data: Second block
Hash: 000000e4530387b122e91de4fedc84b77406a819713c9601b09b29695cb6e336, Previous hash: 000000ddfddf305f15fefdada0939139ea33dc94bca1e57eda5f16d902fec55f, Timestamp: 2018-06-14 13:26:32, Nonce:  17905780, Data: Third block

Enjoy!

❌