Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

COBOL deserves modern, easy to read error messages as well!

42 views
Skip to first unread message

KTSnowy (The Web Dev Fox)

unread,
Mar 24, 2023, 1:43:18 PM3/24/23
to
Although the language was created more than 60 years ago, it has evolved a lot since then and today COBOL can be just as capable as other modern object oriented languages. The latest 2023 standard supports advanced object oriented features and asynchronous messaging, making it just as powerful for backend development as C# and Java!

I know that some developers might disagree with how useful object oriented COBOL is, but in reality, there are certain things that are difficult, if not impossible to express well in procedural only code. An example of this is a generic class with overloaded methods, attempting to express that in procedural code would require a ton of unnecessary code duplication, which is specially bad considering that the language already supports generic classes and overloaded methods just like C# and Java.

But unlike C# and Java, it's not as easy to use COBOL's more advanced features without freely accessible teaching resources for those, but also the compiler frontend infrastructure needed to display useful and readable error messages for these features.

Because of that, we made a new modern error message system for Otterkit, which should still display useful information to experienced developers, while also being easy to read and understand for new developers. This new format was inspired by Rust's error messages, and both the Errata NuGet package and Ariadne Rust crate.

Otterkit's frontend is built using a handwritten recursive descent parser (which is the industry standard for production-level compilers), this allows us very precise control over exactly where and when to display an error, and also the exact error message that it should display to the developer.

Below is an example of how these errors look like with the new error message system:

https://i.imgur.com/z99Wq3V.png

We're looking for feedback on both the format and the contents of the error messages, as well as help writing more of these to provide useful error messages to users.

The new error message system is modular, and allows us to add or remove parts of the message as needed for different scenarios, it also allows us to expand the format by implementing more parts in the future that can be composed together. Currently, the "Note" part is optional, and the error message can still work without it:

https://i.imgur.com/5v9QVF5.png
Same error message, but without the Note.

We'll start replacing our previous error messages with new ones that take advantage of the new system soon! This should hopefully help the overall COBOL development experience, and should help new developers learn COBOL more easily.

Note: Otterkit is still in prerelease and is not yet complete, any feedback is welcome. We're looking to improve the COBOL ecosystem and we hope COBOL developers also agree with the need to modernize through open source and freely accessible tooling.

https://github.com/otterkit/otterkit

Kerry Liles

unread,
Mar 24, 2023, 3:11:06 PM3/24/23
to
I very much like the proposed error message format and layout. When I
can find some time I intend to poke around with your Otterkit prerelease
compiler and look forward to driving it around...


KTSnowy (Otterkit Core Dev)

unread,
Mar 24, 2023, 6:56:27 PM3/24/23
to
Here's another example of the format: https://i.imgur.com/t6kMAEU.png

I started replacing the previous messages with the new system.

This can be amazing at providing useful diagnostics, specially with the extra fine tuning that the handwritten recursive descent gives us.
0 new messages