-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
johnno1962
wants to merge
11
commits into
swiftlang:main
Choose a base branch
from
johnno1962:character-ops
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
johnno1962
force-pushed
the
character-ops
branch
from
February 20, 2024 21:48
f0a4cbf
to
b85f57b
Compare
johnno1962
requested review from
ahoppen,
bnbarham,
CodaFi,
DougGregor,
hamishknight and
rintaro
as code owners
March 13, 2024 15:40
johnno1962
force-pushed
the
character-ops
branch
2 times, most recently
from
March 13, 2024 15:57
06c1fe7
to
c234ef4
Compare
rintaro
added
the
swift evolution proposal needed
Flag → feature: A feature that warrants a Swift evolution proposal
label
Mar 14, 2024
johnno1962
force-pushed
the
character-ops
branch
from
March 15, 2024 13:19
2cbc14a
to
326125a
Compare
@rintaro, there is a proposal mentioned in the opening comment. |
johnno1962
force-pushed
the
character-ops
branch
3 times, most recently
from
August 20, 2024 01:43
783d51b
to
fcfab76
Compare
johnno1962
force-pushed
the
character-ops
branch
5 times, most recently
from
August 20, 2024 11:49
dbe8f37
to
6e80e8f
Compare
johnno1962
force-pushed
the
character-ops
branch
from
August 20, 2024 12:42
6e80e8f
to
455ed93
Compare
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aUInt8
value to a double quoted single unicode code point string literal for equality, make this comparison in aswitch
. 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