[libre-riscv-dev] API design article "Abstracting Away Correctness"

Jacob Lifshay programmerjake at gmail.com
Tue Jul 7 07:19:59 BST 2020


I found a nice article discussing API design in the context of Go and Rust,
describing using counterexamples from Go's standard library why designing
using types and interfaces that are impossible to accidentally misuse is
important.

https://fasterthanli.me/articles/abstracting-away-correctness

This is one of the major reasons I prefer a stereotypical Rust API designs
over a stereotypical Python, C, or JavaScript API: Rust's culture actively
encourages APIs to be as accident-proof/dummy-proof as possible, being
designed for correctness, greatly reducing the occurrence of logic errors
since, with Rust, it *is* often true that if the code compiles then it will
work.

C, C++, Python, Go, JavaScript, and many other languages are definitely not
that way, being filled with gotchas that even experienced programmers will
hit.

Jacob


More information about the libre-riscv-dev mailing list