-
Notifications
You must be signed in to change notification settings - Fork 741
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
Mixed-case numbers not parsed #309
Comments
The behaviour is intended, and personally I do not think it is necessary to make that explicit in the docs. Surely, I am reluctant to do any more work on the user-defined alphabet functionality anyway. It's a bit niche and left-field, and I don't want it to add much code weight to the library as I don't think the vast majority of users ever use it. I think just adding a note to the docs will suffice for #250. Of course, I would be happy to give feedback on and potentially accept other ideas/PR's on the matter - and don't get me wrong, I think you are on the right lines in regard to storing alphabets as objects rather than strings. |
I think it's hard to say this behavior is intended when it's undocumented and is not in line with how most languages parse hexadecimal literals.
I think I may have misconstrued what I was intending with this. I was thinking I believe a solution would be fairly trivial to implement. I will give it a try and report back. |
Other languages do not allow user-defined 'alphabets' that include lower and upper-case versions of letters. In such alphabets, the numerical value of a letter necessarily differs depending on its case, so it seems inappropiate to ever allow mixed-case letters in the same string to have the same numerical value. The use of mixed case values for single-case-alphabet bases is more likely to be a mistake on the users part. |
See #310. Documented the current behaviour in v9.0.2. |
If a string input has mixed-case letters, the value will fail to parse. If this is expected, it should be clarified in the documentation. I dug in to the code and it appears that it's doing a pseudo-case-insensitive match, but will only work if the input is entirely uppercase or lowercase.
Input:
Output:
Fixing this may prove difficult, considering case-sensitive alphabets exist and should remain supported.
It may be overkill, but I would recommend a solution where alphabets are stored as an object rather than a string, that way we can do analysis of the alphabet when it is constructed and determine metadata like case-sensitivity, etc.
The text was updated successfully, but these errors were encountered: