logoalt Hacker News

fc417fc802last Sunday at 3:30 AM1 replyview on HN

It's not about C semantics it's about the name of a commonly understood concept. What you just described there is the "result" pattern not the "optional" pattern. Of course the designers are free to call it whatever they want but swapping common terminology like that is a blunder from my perspective.


Replies

jeremyjhlast Sunday at 4:19 AM

This is not exactly the same as the Result pattern. It doesn't require an ADT feature and does not require the programmer to specify a type for the possible error value.

Also syntactically it is quite different: it means you add exactly one character to the function head to denote that its possible to return an error.

So, calling that feature "Result" could also be confusing to people who have not yet learned this language.

Tell me, was it a blunder when Rust swapped "Result" from the commonly understood name of "Either" from OCaml/Haskell ?