-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checked constructor for potential error conditions (#4)
* checked constructor for potential error conditions This commit introduces a variant of the NewChooser constructor that will error on conditions that could later cause a runtime issue during Pick(). The conditions handled are a lack of valid choices and a potential integer overflow in the running total. This is a proof of concept, but the final API may likely be different to avoid introducing extra complexity into the library. This commit merely serves as the intial code to aide a discussion in the PR. * checked constructor as new default * privatize sentinel errors for NewChooser I don't see a current use case scenario where being able to act upon these as sentinel errors would be significant, so better to avoid the API complexity and keep them private for now. Always easier to export them later if needed than taking them away once out in the wild. * docs: clean up variable names
- Loading branch information
Showing
5 changed files
with
117 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters