Adding Result to the Standard Library

Just throwing a few IMHO points out there.

  • Either is a semantically-erased unbiased coupled enumeration
  • Result is biased and semantically-driven
  • Result shouldn't be tied to Cocoa's historic NSData, NSError structure solely for the sake of historic trend.
  • Arbitrary typing enables both success/error handling as well as success/fallback. I would name the branches (and the generic type arguments) something along the lines of enum Result<Expected, Unexpected>{ case expected, unexpected } or maybe (thanks Brent) Primary, Alternate.
  • Adding Result should not exclude Either.
3 Likes