Emptiness

Great thinking over at Khanlou.com about types that implement isEmpty and the weird tri-state they can be in if Optional. I also have a self-imposed rule forbidding optional Arrays and Dictionarys.

I should probably extend this practice to Strings, but treating "" different from " " gives me the heeby jeebies. So I have a maybeBlank()->String? extension on String that returns the string or nil if it’s empty or whitespace.

This article really calls out how insane that is.