-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small error-message consistency improvement for bit indices (#852)
Functions like `vector-ref`, `string-ref`, `substring`, and `bitwise-bit-field` report a non-exact-integer index as a "bad index" error. But `bitwise-bit-set?`, `logbit?`, `logbit0`, and `logbit1` said "not an exact integer", instead, while reporting "bad index" for a negative exact integer; `bitwise-copy-bit` said "not a nonnegative exact integer". This commit changes the error message for those last five functions to always say "bad index". Fixnum variants of the operations can still say "not a fixnum" or "invalid bit index", depending on whether the index is a negative fixnum. That seems justified on the grounds that fixnum operations add an extra constraint on their arguments. Another possible direction is to change the error messages to consistently "not a nonnegative exact integer" and "not a nonnegative fixnum", since (unlike other index cases), the index validity is independent of the indexed value. After trying out both, sticking with "invalid bit index" seems clearest and the most in the spirit of the current error messages.
- Loading branch information
Showing
4 changed files
with
30 additions
and
27 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