Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Result variants Ok/Err to Pass/Fail #62

Open
soc opened this issue Oct 31, 2022 · 2 comments
Open

rename Result variants Ok/Err to Pass/Fail #62

soc opened this issue Oct 31, 2022 · 2 comments
Labels
dora-diverge will cause substantial diversion from dora library changes to the Core standard library

Comments

@soc
Copy link
Collaborator

soc commented Oct 31, 2022

I was never too happy with the existing naming approaches for the Result type:

Success/Failure

  • pro: both names have the same length, like Option's Some/None
  • con: quite long, concern that people may use Option over Result

Ok/Err

  • pro: short
  • con: names don't have the same length, leading to inconsistent indentation when pattern matching
  • con: Err is not a word

The new naming ticks all the boxes:

Pass/Fail

  • pro: both names have the same length
  • pro: same length as Some/None
  • pro: real words

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!

@soc soc added this to the 1.0 – polishing milestone Oct 31, 2022
@soc soc added dora-diverge will cause substantial diversion from dora library changes to the Core standard library labels Nov 6, 2022
@soc
Copy link
Collaborator Author

soc commented Nov 10, 2022

After the implementation of #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.

@soc
Copy link
Collaborator Author

soc commented May 3, 2024

Adrian from Coffee Compiler Club mentioned Is and No as a possibility. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dora-diverge will cause substantial diversion from dora library changes to the Core standard library
Projects
None yet
Development

No branches or pull requests

1 participant