Working on my first actual #rustlang (toy) project, which is nothing fancy, I started noticing how having the `Option` and `Result` enums baked into the standard library forces me to think about edge cases from the start so I know that when my code finally compiles, many rough edges are already solved.
It doesn’t remove the need for tests, but it definitely helps building robust software from the get go !
Conversation
Notices
-
Embed this notice
Clément Robert :python: (neutrinoceros@fosstodon.org)'s status on Saturday, 16-Mar-2024 00:42:02 JST Clément Robert :python: -
Embed this notice
powersoffour (powersoffour@mastodon.social)'s status on Saturday, 16-Mar-2024 00:42:01 JST powersoffour @neutrinoceros I found the same thing! I hated it the first two times and then the third I was like, oh, hey, yeah.
(Mind you I still am a rust newb. I've just written more than 3 Option/Result things.)
-
Embed this notice
powersoffour (powersoffour@mastodon.social)'s status on Saturday, 16-Mar-2024 00:49:50 JST powersoffour @neutrinoceros One thing I've been seeing in DOS stuff is often fundamental constraints were applied on certain values. Like, if a variable was defined as AX & 0x0f, then it couldn't possibly be more than 15. But when Ghidra runs into a jump table that uses an offset based on, say, (AX&0xf), it will still assume that it could taken on values up to 255 -- which ends up with jump targets all over the code. Anyway this has been kinda fun and makes me think about switch-y statements differently.
-
Embed this notice