Hacker News new | past | comments | ask | show | jobs | submit login
The OpenBSD Ada Library (verisimilitudes.net)
88 points by verisimilitudes on Aug 4, 2019 | hide | past | favorite | 19 comments



Ada is my favorite 'almost' language. I'm writing a Kalman filter example in it right now. Just about every programming error from some large C/C++ codebase wouldn't happen in Ada. It's got manual and automatic memory management, separate storage pools, packed arrays, arbitrary precision floating point types, fixed point types, checked integers, generic packages and functions, tasking, real-time support (how many other languages have a Delay_Until function in the standard library?)... It's like graphene - it does everything except get used in the real world (outside of specialized applications like Aerospace).

A fun thing to do is look for Ada tutorials from after the year 2000. There aren't many.


Ada is hindered by the compiler situation.

The GCC frontend has always been second-tier at best, and AdaCore is very expensive (it's technically GPL, but you will never get a copy, except directly from AdaCore with further contractual restrictions).

They finally released a "Community Edition", but you may only develop Open Source software with it.

It's a shame. Ada is really nice.


I think your comment mostly hits the nail on the head.

Ada is a really nice language that is fast, has lots of support for making sure programs are reliable, can run on desktops or microcontrollers, has a really good concurrency story and parallelism is coming next. I like the syntax a lot and was recently making some small programs and having a blast. That all changed when I found out I could only distribute my programs with the full source unless I paid adacore what is likely a lot of money (I can't be certain as it is not listed on their site). Technically, there is a GCC clause that allows you to distribute as closed source, but then you can't use any adacore libraries and it all seems tricky.

No thanks, I'm not even remotely interested in that kind of relationship. D will have to do for my use cases.

Commercial tools aren't a problem to me, but they need a tooling option for solo devs that don't work for a 5,000 person company on a military project.

Adacore seems like a neat company with a great product, but the current situation seems to be hindering language adoption outside of larger military contracts and university research


I don't know what you mean by "second tier", it's a well-crafted compiler. It compiles extremely quickly, generally produces excellent binary code, and produces excellent error messages. For a brief discussion about its design, and links to more info, see my post here: https://dwheeler.com/essays/make-it-simple-dewar.html


Sure it's well-crafted. It's second tier in GCC, though. How many GCC developers do you think are comfortable in that part of the compiler?


The same amount that are comfortable across Fortran, C, C++, Go and D, plus the experimental branches from Modula-2 and Pascal.


> The GCC frontend has always been second-tier at best

Either explain what you mean by this, or you're comment isn't useful. AFAIK GNAT is just the n-1 version of their commercial offering (for the base language) nothing's wrong with that..


on a regular basis, AdaCore people will post patches to the gcc mailing list with improvements to the compiler. they are in no obligation to do so, but they are good citizens. likewise, they also contribute to the core of gcc. a couple of years ago i heard that they are targetting a version based on clang. now that is something that could stay closed source.


the gcc version of ada is really good. unless you can't get a version of gcc for your target, it is probably OK for 'regular' (non high reliability, external certification) uses. if you want support, or support a target out of the mainstream, then the AdaCore product is the place to go (or another commercial vendor).

ada is also very portable across vendors (since 2000 or so). the only language easier to go from vendor A to vendor B is fortran.


There are so many standardized languages out there that have many implementations. Some commercial and some free.

Are there other free Ada compilers out there or is the language too complex for simple enthusiasts to implement a compiler themselves?

Ada isn't owned by one company.


Ada has around 6 implementations available, only GNAT is open source.

The language is at the same level as Haskell, OCaml, C++ or similar.


I thought the GNU version that comes with most distros was under the same license as the rest of GCC?


Yes, but the GCC frontend is always a few steps behind, big parts of the test suite are proprietary, the Annexes aren't implemented (AFAIK), and – (hyperbolically) everybody who gained proficiency with gnat-gcc was hired by AdaCore.


Sounds like someone needs to start an Ada on LLVM project! Maybe US DoD, automakers, medical device manufacturers, etc. would even provide support/funding.


There was some attention given to using the DragonEgg project for this purpose. I don't think it ever gained any traction, unfortunately. One unfortunate factor that inhibits the porting of Ada to new platforms is that the language's real power lies in it's runtime library. Whether or not your compiler can target a specific architecture is only part of the problem of cross-platform development. In order to use the compiler for development on the target platform you'll need a functioning RTS.


learn.adacore.com (https://learn.adacore.com/courses/intro-to-ada/index.html) and the Ada Programming wikibook (https://en.wikibooks.org/wiki/Ada_Programming) are pretty good tutorials that cover Ada including Ada 2012 features.

I recently found this Awesome Ada list (https://github.com/ohenley/awesome-ada/blob/master/README.md) and have found it useful to discover libraries and frameworks written in Ada.

With the increased interest in safe programming that Rust has stoked, I am hopeful that Ada might also find some renewed interest.


It's very unfortunate that this language doesn't get the recognition that it deserves. In today's world there's more need than ever for high assurance languages.


OpenBSD pledge(2) and unveil(2) are relatively easy to create high level language bindings for, and users have already contributed several in the community, like this latest one for Ada. In base, OpenBSD only supports C/C++, however a Perl interface is also included.

https://man.openbsd.org/man3p/OpenBSD::Pledge.3p

https://man.openbsd.org/man3p/OpenBSD::Unveil.3p

A few bindings are also maintained in ports, for example GHC/Haskell (unix package) & Node.js (node-pledge) include them out of the box.

For an unofficial list of highlevel language bindings: https://gist.github.com/ligurio/f6114bd1df371047dd80ea9b8a55...


Yes; this was good to ''cut my teeth on'', as it's a rather simple package and, being so self-contained, I'm actually entirely pleased with its specification.

>In base, OpenBSD only supports C/C++, however a Perl interface is also included.

I'm soon going to drop by the OpenBSD mailing list and see if they're interested in including this in their prepackaged GNAT. It won't harm to ask.

Related to this, I intend to write a binding for Common Lisp, at some point, although that will be far more arduous, all things considered.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: