HNHacker News
TopNewBestAskShowJobs

rept0id-2

17 karma · joined September 25, 2024

submissionscomments
rept0id-2··on A lib with a hard to misuse API (based on Matt Godbolt)
The functionality of this library is to calculate compounded interest... but the real purpose is to test Matt Godbolt's suggestions from "Correct by Construction: APIs That Are Easy to Use and Hard to Misuse - Matt Godbolt - C++ on sea" on a high-level language.

Matt gives us the example of a stocks trading API that is implemented in C++. Because we wanted to test what we saw there on a high-level language, we picked Python.

rept0id-2··on A lib with a hard to misuse API (based on Matt Godbolt)
A lib with a hard to misuse API (based on Matt Godbolt)
rept0id-2··on Ratatoi is a C libary that wraps stdlib's strtol (as atoi does), but it's evil.
Ratatoi is a C libary that wraps stdlib's strtol (as atoi does), but it's evil.

If an overflow is detected, it calls abort(), you crash and get Aborted (core dumped).

This way, you prioritize memory safety over silently running in a wrong state, without needing to call strtol and check errors manually everywhere.

rept0id-2··on Folding Home Badge
Promoting Folding@Home through gitification