|
|
Log in / Subscribe / Register

Cro: Maintain it With Zig

Cro: Maintain it With Zig

Posted Sep 11, 2021 0:49 UTC (Sat) by dvdeug (guest, #10998)
In reply to: Cro: Maintain it With Zig by mario-campos
Parent article: Cro: Maintain it With Zig

For Ada, Ada's old. It doesn't have a lot of the fancy features new systems have, and its system of generics is the very first generic system in any major programming language, the direct ancestor of C++ templates. It is, in many ways, an advanced object-orientated Pascal. (It was the first internationally standardized object-orientated language, in its 1995 iteration.)

For upsides, for one, it's been around for 40 years, and there's a group working on the next ISO standard version. Like Fortran, it will be around for a few more decades. It's got more support than D or Nim or Zig, and unlike Go or Rust, I know it's going to be there for a while. (Look at Perl and Adobe Flash for other examples of shifting sands.) The military and aviation support will keep it alive, and AdaCore is dedicated fairly solidly to supporting the open source community.

For the other, it's a lot more powerful than C and a lot less hairy than C++. It's a fully object orientated language with generics, concurrency and Unicode support. The last update added a lot of support for invariants and the next is working on a lot of more convenient parallel processing constructs. SPARK is a formally provable subset, and there's subsets for running without dynamic memory allocation and for hard real-time systems.

I went hard into Ada after fighting with pre-ISO C++, and I sometimes group it in with my early years in BASIC, as something to be remembered more fondly than used, but SPARK is easier to use than Coq, and for a powerful language at the lowest level of the system, personally, Rust may be the only sane alternative.


to post comments

Cro: Maintain it With Zig

Posted Sep 11, 2021 2:46 UTC (Sat) by Cyberax (✭ supporter ✭, #52523) [Link] (1 responses)

I tried to look into Ada once and I haven't been able to understand how it deals with pointers and heap data. Are there any guides for that?

Cro: Maintain it With Zig

Posted Sep 11, 2021 3:24 UTC (Sat) by dvdeug (guest, #10998) [Link]

I don't know about guides. It just basically calls pointers access variables, and initalizes them with "new" and you have to make a free function with the generic package Ada.Unchecked_Deallocation, so it's little more sophisticated than C on this. (The clunky free function name is apparently because they assumed everyone would using garbage collection in the future in 1980, so deallocating memory needed to be marked. In practice, except for a couple short-lived JVM or .NET ports, nobody has ever used GC with Ada.) There's object finalization, so you can hide it behind objects that will automatically deallocate the memory when leaving scope, and storage pools, so you can control where memory for certain types gets allocated from, but by and large, it's like C, with all the potential use-after-free errors.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds