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

Alternative formulation of orElse and getOrElse #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Aankhen
Copy link

@Aankhen Aankhen commented Jun 5, 2018

cc #4

This renames the current getOrElse to getOr and adds a new getOrElse that takes a function returning a value. In case it helps, this matches Rust’s Option.unwrap_or_else and Scala’s Option.getOrElse. It is, obviously and unfortunately, a breaking change.

If this makes sense, I would like to extend the PR to do the same for the current orElse, for consistency: it should be renamed to or, and orElse should be the version that takes a function returning an Option.

(I also fixed the duplicated fourth test.)

@Aankhen
Copy link
Author

Aankhen commented Dec 25, 2019

Merry Christmas! Just gonna bump this in case you get the chance to review it…

@Aankhen
Copy link
Author

Aankhen commented Dec 25, 2019

I added the orElse/or changes I mentioned above too.

@Aankhen Aankhen changed the title Alternative formulation of getOrElse Alternative formulation of orElse and getOrElse Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant