top | item 44782530

Squashing my dumb bugs and why I log build IDs

14 points| zoidb | 7 months ago |rachelbythebay.com

6 comments

order

phyzome|7 months ago

Of course, if that code had been written in Rust, the compiler would have caught the bug... no tests necessary, and no need to stick to clever coding patterns and write your own wrappers.

I know she likes her C, but I wonder if she'll eventually come around, drawn by the better reliability.

kevin_thibedeau|6 months ago

This isn't C. At least denigrate the correct language.

The problem here is a flawed object design that requires external knowledge of when methods can be called. The fix is to detect invalid calls to value(), log/print to stderr, and call abort(). With a suitable test suite these logic errors will reveal themselves before a release build.

valicord|6 months ago

How would the compiler have caught this bug in rust?