Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

kj::Maybe has an `orDefault()` method that is like `.value_or()` but I find that it is almost never useful. You almost always want to execute different logic in the null case, rather than treat it as some default value.


Then you can make a quick helper subroutine that adds a monadic interface to optional and you can lint away all non-conforming uses of optional.




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

Search: