Idea: Functions have (or rather, need) two 'channels' of input/output. One for the parameters and result, and one for metadata like did the call succeed.

  • Java/C# call the second channel 'Exceptions'
  • Go returns an extra result.
  • C embeds it in the primary result, or uses global state ("errno") (or both).
  • Haskell/functional languages put it in the type system.

HTTP calls them 'headers' and has scope for a lot more data then just success/failure (and maybe failure reason), but that doesn't count because it's not a programming language.

I think Lisp (or rather, some dialects of Lisp) allow the programmer to add metadata to variables. With a few support functions, that could be used to tag values before they're returned (e.g. with success/fail, expiry time, confidence level).

Or maybe Haskell is right, and that stuff all belongs to the Type.