Open soc opened 1 year ago
After the implementation of https://github.com/core-lang/core/issues/8, Option
and Result
could actually "share" the good case:
class Some[T](val: T)
module None
enum Option[T] of Some[T], None
enum Result[T, E] of Some[T], ???[E]
This still leaves open the question what to call the non-success variant of Result
.
Adrian from Coffee Compiler Club mentioned Is
and No
as a possibility. :-)
I was never too happy with the existing naming approaches for the
Result
type:Success
/Failure
Option
'sSome
/None
Option
overResult
Ok
/Err
Err
is not a wordThe new naming ticks all the boxes:
Pass
/Fail
Some
/None
It's a minor thing, but it's nice to have found a good design even where it doesn't matter that much!
The only concern I have is that I might find a type in a testing-related context where
Pass
/Fail
would fit even better!