-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Character "#" is defined as "pound" #1
Comments
Well, I'm so happy you find it useful! And thank you for filing this issue. You made me realize that I did not know what the "correct" name for this symbol is, and it turns out to be regional! There is no standarized name, althought unicode has chosen to name this "number sign". I'm happy to fix this, or accept a PR. But it isn't clear to me that "hash" is unambiguously the right choice. I'm tempted to follow unicode here. What do you think? Also, any change here will be source-breaking, so I'm not even sure what the right approach to making the change would be. |
OK, after asking ChatGPT what would be the right name for the symbol, I understand better the problem.
I thought that you confused # with £. This is indeed a more regional issue... The only solution I have in mind would be to name # If you decide to add some day the £ symbol, it could be named something like Btw, I was wondering how you decided to populate your
It could have been a good shortcut to check tokens and when using next and peek. |
I also realize that indeed, making any change in the This is getting more complicated than expected. |
Ok, so first for the naming. I completely agree that "pound" is a poor choice. I decided to go with the unicode naming "numberSign", which is not regional and seems quite stable. But I also introduced this: @available(*, deprecated, message: "Please use numberSign")
public static let pound = BasicTextCharacterKind.numberSign There are situations where this could still be breaking in subtle ways, but I have a feeling it won't be a problem. What do you think? |
The whole idea with You can always define your own custom sequence if that isn't an appropriate building block.
I honestly don't remember! It does seem like this could be a good idea, though I have not looked closely at it. It would definitely be possible to make a new sequence that does it. |
Your solution looks like a good approach to me. The warning could be enough to let people that this is not the £ symbol, and gently invite those how already used the # symbol as pound to update their code.
Yes, I will create my own sequence based on what you started. Thanks for your help, and feel free to close this issue! |
Sounds great. And thanks again for bringing this up! |
Hello!
First, thank you for that useful library.
I think there is an error in the
next
method ofBasicTextCharacterSequence.
case "#": return BasicTextCharacter(kind: .pound, range: range)
It should be
hash
(which does not exist yet).Let me know if you want me to write a PR, or if you prefer to fix that yourself.
The text was updated successfully, but these errors were encountered: