Hacker News new | ask | show | jobs
by AaronFriel 2197 days ago
Then you can't construct it unless it's successful, no?

A Result<T> that can only contain successful values doesn't seem very useful

1 comments

You can, it's possible to address "missing values" with a default construct. Example:

  int x = default; // x becomes zero
  T x = default; // x becomes whatever the default value for struct is
Then we're back to accessing that value being an enormous footgun, yes?