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

binary-search: Use error object instead of sentinel -1 #1338

Merged
merged 1 commit into from
Sep 24, 2018
Merged

binary-search: Use error object instead of sentinel -1 #1338

merged 1 commit into from
Sep 24, 2018

Conversation

petertseng
Copy link
Member

binary-search 1.2.0

As discussed in
#1312

Although -1 is a sentinel value, using this sentinel value is not the
usual course of action in some languages. In using an error object, we
avoid giving the wrong idea that we are requiring the use of the
sentinel value.

This error value was defined in
#401

Of course, languages that wish to use a sentinel value may continue to
do so; this commit is not intended to decree that sentinel values are
forbidden.

Neither is this commit decreeing that all languages must represent this
condition as an error; it is simply a declaration that this condition
bears enough consideration that we'll represent it with a different
type.

Closes #1312
Checks the related box in #1311

binary-search 1.2.0

As discussed in
#1312

Although -1 is a sentinel value, using this sentinel value is not the
usual course of action in some languages. In using an error object, we
avoid giving the wrong idea that we are requiring the use of the
sentinel value.

This error value was defined in
#401

Of course, languages that wish to use a sentinel value may continue to
do so; this commit is not intended to decree that sentinel values are
forbidden.

Neither is this commit decreeing that all languages must represent this
condition as an error; it is simply a declaration that this condition
bears enough consideration that we'll represent it with a different
type.

Closes #1312
Checks the related box in #1311
Copy link
Contributor

@sdublish sdublish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @petertseng!

@petertseng
Copy link
Member Author

Thanks! My plan will be to merge it in about 48 hours if I don't hear reason I should not.

@petertseng petertseng merged commit e0ffb00 into exercism:master Sep 24, 2018
@petertseng petertseng deleted the binary-search-err branch September 24, 2018 06:35
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.

3 participants