Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hirrolot committed Nov 9, 2021
2 parents 0c1a9b0 + 981f624 commit 002d214
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,23 +510,30 @@ Thanks to Rust and ML for their implementations of sum types.

### Q: Why use C instead of Rust/Zig/whatever else?

A:
A: There is a lot of software written in plain C that can benefit from Datatype99; C is #1 programming language as of 2020, [according to TIOBE](https://jaxenter.com/c-programming-may-2020-171598.html). People use C due to technical and social reasons:

- Datatype99 can be seamlessly integrated into existing codebases written in pure C -- just `#include <datatype99.h>` and you are ready to go. On the other hand, other languages force you to separate native C files from their sources, which is clearly less convenient. There is a lot of software written in plain C that can benefit from Datatype99; C is #1 programming language as of 2020, [according to TIOBE](https://jaxenter.com/c-programming-may-2020-171598.html).
- Datatype99 can be seamlessly integrated into existing codebases written in pure C -- just `#include <datatype99.h>` and you are ready to go. On the other hand, other languages force you to separate native C files from their sources, which is clearly less convenient.

- In some environments, developers strick to pure C for historical reasons (e.g., embedded devices, Linux and other operating systems).

- C has a stable ABI which is vital for some projects (e.g., plugin systems).
- C has a stable ABI which is vital for some projects (e.g., plugin systems such as [MetaCall]).

- C has a complete specification, unlike Rust. This has far-reaching implications, such as multiple implementations and fixed language behaviour. I know a few stories in which Rust was rejected as a language for a new project since it lacks a complete specification, and I can understand this decision.
- C is a mature language with a complete specification and a plenitude of libraries. Rust has no complete specification, and [Zig] is not yet production-ready. I know a few stories when these two languages were rejected for new projects, and I can understand this decision.

- Historically, C has been targeting nearly all platforms. This is not the case with Rust, which depends on LLVM as for now.

- Your company obligates you to use C.

- Etc.

[MetaCall]: https://github.com/metacall/core
[Zig]: https://ziglang.org/

See also:
- [_Rust is not a good C replacement_](https://drewdevault.com/2019/03/25/Rust-is-not-a-good-C-replacement.html) by Drew DeVault.

Overall, if you can afford a more modern/high-level language, I encourage you to do so instead of using old C. However, many people do not have this possibility (or it would be too costly).

### Q: Why not third-party code generators?

A: See [Metalang99's README >>](https://github.com/Hirrolot/metalang99#q-why-not-third-party-code-generators).
Expand Down

0 comments on commit 002d214

Please sign in to comment.