Hacker News new | past | comments | ask | show | jobs | submit login

Yes, this, most modern languages embrace this idea of Optional. I believe OCaml might have invented it (I love OCaml too!). Odin has it I think, Rust obviously, and Swift heavily as well.

What's interesting, modern C, is promoting this move as well. Don't just return an integer, return a struct result_t with a fail bool or error bool in it, as opposed to some const char* pointing to null. Do this more and more and your C code starts becoming a lot more digestible and modern (although common sense still applies to not go overboard with these constructs in C, but you can set up a nice contract type API design within your code base).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: