C alternatives

C's unsafety is a common concern, and a common reason to look for alternatives. The subject is debatable, as language comparisons tend to be in general, but here I document my perspective and observations.


The features of C I look for in alternatives:

Features that C lacks, but are desirable and compatible (to some extent) with its existing features:


Does not add any of the desirable features, but adds a lot of complexity, and tends to break compatibility with C and the rest by providing OO APIs.
Some like it, but I have not used it myself, since it is an object-oriented language, which I assume is a source of complication, similarly to C++.
Improves both memory safety and type safety, has decent interfacing with C, but still unstable as of 2023, more or less requiring cargo(1) (its own package manager) to use, and that one aims to have the latest rustc(1) (compiler) version, not helping much if the latest versions of libraries--or of their dependencies--depend on a newer version than installed. Idiomatic asynchronous APIs aim Rust-only sources, not to be called via C FFI. This breaks the "POSIX-friendly" and "availability" features present in C, though they could have been preserved, and it has more to do with the infrastructure than the core language. Related: Rust without crates.io. Though some libraries (crates) are rather lightweight, the difference in the numbers of dependencies of similar ones can be two orders of magnitude (e.g., argparse has no dependencies, while the more popular clap pulls 156 additional packages). Or one can add dependencies using the --precise option, first finding a version compatible with an older rustc version on crates.io. The package index updates are very slow.
Generally easy to interface with C code, though perhaps not to provide a C API, and it is not safer.
Not in Debian repositories, and not sure how much safer it is than C with a little static analysis. Apparently no advanced typing, but at least it supports generics, and sum types via compiler-checked tagged unions (though no "extern C" for tagged unions yet). And it aims interfacing with C. I should look more into it later.
Sometimes C is called a "portable assembly", but it may be practical to compile actual assembly languages for simpler architectures, such as RISC-V, into others as well. Probably higher-level languages, including C, are still more practical than the nicer ones among assembly languages for simpler architectures, but possibly the latter may compete.