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

RFC: use "unknown character" as default Char #5232

Closed
joneugster opened this issue Sep 2, 2024 · 2 comments
Closed

RFC: use "unknown character" as default Char #5232

joneugster opened this issue Sep 2, 2024 · 2 comments
Labels
RFC Request for comments

Comments

@joneugster
Copy link
Contributor

Proposal

Unicode has a dedicated character meaning "unknown character": '\uFFFD'

Currently String.get returns "A" as default value, which might be a tiny bit unexpected and certainly an arbitrary choice.
In my opinion '\uFFFD' would be a slightly better choice.

  • User Experience: How does this feature improve the user experience?
    It might be slightly more understandable if they see '\uFFFD' instead of a random 'A'.
    If a user does s.get ⟨1⟩ where ⟨1⟩ is an invalid String.Pos, they get A returned, which might be confusing

  • Maintainability: Will this change streamline code maintenance or simplify its structure?
    should have no impact on maintainability.

Community Feedback

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

@joneugster joneugster added the RFC Request for comments label Sep 2, 2024
@nomeata
Copy link
Collaborator

nomeata commented Sep 2, 2024

Thanks for the suggestion. I agree in spirit, but I'm not sure if this is the most pressing issue we have at the moment, given all the other things we could fix and the limited developer attention resources.

Also slightly worried that users will be confused to see a character that doesn't render nicely in whatever font they are using.

If you feel strongly about it (and its not just a ”sure why not change”) I suggest to just do it without much more discussion. Else maybe let's focus on other things that are more than “slightly better”, at least for now.

@joneugster
Copy link
Contributor Author

ok, sorry for the bother! The default char might be refelected in teh C code, so this seems too much effort.

I'll resort to using myString.get? pos |>.getD '\uFFFD' instead. (and might PR the missing String.getD at some point)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for comments
Projects
None yet
Development

No branches or pull requests

2 participants