News for hackers. Stuff that matters.
Re:Anti-if: The Missing Patterns by wereHamster on Thursday June 09, 2016 @11:50PM (#11874176)
> I don't really see how using an Optional type would remove the if(null) checks. It just makes the meaning explicit, which is good but not remedying the original problem.

If you always use `Option` (or whatever equivalent your language/base library provides) and banish `null` from your source code you've effectively avoided all null pointer exceptions and can therefore remove all null checks.

Re:Anti-if: The Missing Patterns by thaumasiotes on Friday June 10, 2016 @01:34AM (#11874492)
Well, no, you still need the null checks. You've eliminated null pointer exceptions by guaranteeing that null is always checked for before the value is used -- you're still checking, but you're now immune to unanticipated crashes. (That would have resulted from null dereferences, that is. You can still have other bugs.)
Re:Anti-if: The Missing Patterns by lmm on Friday June 10, 2016 @10:14AM (#11876469)
You need checks but only in the cases where you need checks. More importantly, nullable values are very obvious in the code (and should very much be the exception rather than the rule), so the cases where you need to think about "what if that's null" are cases you actually think about.