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

Make `Char.toCode` Roundtrip #747

Closed
wants to merge 1 commit into
base: dev
from

Conversation

Projects
None yet
4 participants
@crazymykl

crazymykl commented Nov 2, 2016

Synopsis

It's quite surprising that certain Chars cannot be converted to integers and back losslessly.

Open Questions

  • I have made Char.fromCode keep its existing behavior when given an Int outside of the range of valid Unicode. Should it be made KeyCode -> Maybe Char instead?
@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Nov 2, 2016

Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Nov 2, 2016

Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@crazymykl

This comment has been minimized.

Show comment
Hide comment
@crazymykl

crazymykl Nov 2, 2016

This is related to #387.

crazymykl commented Nov 2, 2016

This is related to #387.

@crazymykl

This comment has been minimized.

Show comment
Hide comment
@crazymykl

crazymykl Nov 4, 2016

I spoke with @rtfeldman , and losing O(1) length is a hard-no. I'd still like the functions on Char that convert from keycodes to roundtrip.

crazymykl commented Nov 4, 2016

I spoke with @rtfeldman , and losing O(1) length is a hard-no. I'd still like the functions on Char that convert from keycodes to roundtrip.

@crazymykl crazymykl changed the title from Make Strings Transcend the Basic Material Plane to Make `Char.toCode` Roundtrip Nov 4, 2016

@jahewson

This comment has been minimized.

Show comment
Hide comment
@jahewson

jahewson Nov 4, 2016

Can a KeyCode actually contain a surrogate pair? As far as I'm aware KeyboardEvent.keyCode generates only ASCII and Windows-1252 characters.

Incidentally, a KeyCode from the Keyboard library is not even guaranteed to be Unicode, it could be Windows-1252. Seems like this could be a broader problem for Elm, which appears to assume that a KeyCode is a Unicode code point, because it mingles Keyboard and Char logic via KeyCode.

I suspect that the whole relationship between KeyCode and Char needs some re-thinking.

jahewson commented Nov 4, 2016

Can a KeyCode actually contain a surrogate pair? As far as I'm aware KeyboardEvent.keyCode generates only ASCII and Windows-1252 characters.

Incidentally, a KeyCode from the Keyboard library is not even guaranteed to be Unicode, it could be Windows-1252. Seems like this could be a broader problem for Elm, which appears to assume that a KeyCode is a Unicode code point, because it mingles Keyboard and Char logic via KeyCode.

I suspect that the whole relationship between KeyCode and Char needs some re-thinking.

@evancz evancz closed this Nov 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment