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

Simple operators for character value comparisons. #71749

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

johnno1962
Copy link
Contributor

@johnno1962 johnno1962 commented Feb 20, 2024

Hi Apple,

After a long deliberation on swift-evolution I'd like to propose these operators and initialisers be added to the standard library to improve the ergonomics of working with the integer representation of character values. This has already be explored and benchmarked extensively on this PR to the swift-syntax project which was merged some weeks ago. I've tried to pair it down to the absolute minimum so there shouldn't be anything too contentious in what remains. In summary you can compare a UInt8 value to a double quoted single unicode code point string literal for equality, make this comparison in a switch. There is also a new initialiser for all integer types from a unicode scalar and finally a new Array initialiser from the unicode scalars in a String.

These operators use the existing language to improve the ergonomics of parser code without having to press into service single quotes and make changes to the compiler as has been previously proposed. PR to swift-evolution with the proposal to follow.

Resolves #SR-9032

@johnno1962 johnno1962 force-pushed the character-ops branch 2 times, most recently from 06c1fe7 to c234ef4 Compare March 13, 2024 15:57
@rintaro rintaro added the swift evolution proposal needed Flag → feature: A feature that warrants a Swift evolution proposal label Mar 14, 2024
@johnno1962
Copy link
Contributor Author

@rintaro, there is a proposal mentioned in the opening comment.

@johnno1962 johnno1962 requested a review from a team as a code owner August 19, 2024 22:52
@johnno1962 johnno1962 force-pushed the character-ops branch 3 times, most recently from 783d51b to fcfab76 Compare August 20, 2024 01:43
@johnno1962 johnno1962 force-pushed the character-ops branch 5 times, most recently from dbe8f37 to 6e80e8f Compare August 20, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
swift evolution proposal needed Flag → feature: A feature that warrants a Swift evolution proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants