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

Create 0233-codepoint-and-character-literals.md #939

Open
wants to merge 9 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@kelvin13
Copy link
Contributor

kelvin13 commented Oct 24, 2018

Swift’s String type is designed for Unicode correctness and abstracts away the underlying binary representation of the string to model it as a Collection of grapheme clusters. This is an appropriate string model for human-readable text, as to a human reader, the atomic unit of a string is (usually) the extended grapheme cluster. When treated this way, many logical string operations “just work” the way users expect.

However, it is also common in programming to need to express values which are intrinsically numeric, but have textual meaning, when taken as a Unicode scalar value. We propose adding a new literal type CodepointLiteral which takes single-quotes ('), and is transparently convertible to Swift’s integer types. This syntax will extend to all “scalar” text literals, up to and including Character (through the CharacterLiteral type), and will become the preferred literal syntax these types.

@lattner

This comment has been minimized.

Copy link
Collaborator

lattner commented Nov 8, 2018

@DougGregor was going to take a look at this when he had a chance and make a few suggestions.

kelvin13 added some commits Dec 13, 2018

@lattner

This comment has been minimized.

Copy link
Collaborator

lattner commented Jan 16, 2019

The core team is getting close to running this, I am going to make a pass over the proposal and after those comments are resolved (either a change made, or you just "ack" them and tell me that it is correct as is) then we can get it scheduled and go. Thanks!

@lattner
Copy link
Collaborator

lattner left a comment

Overall, LGTM, thank you again for driving this!

* Authors: [Kelvin Ma](https://github.com/kelvin13) ([@*taylorswift*](https://forums.swift.org/u/taylorswift/summary)), [Chris Lattner](https://github.com/lattner) ([@*Chris_Lattner3*](https://forums.swift.org/u/Chris_Lattner3/summary)), [John Holdsworth](https://github.com/johnno1962) ([@*johnno1962*](https://forums.swift.org/u/johnno1962/summary))
* Review manager:
* Status: *Awaiting review*
* Implementation (WIP): [`johnno1962:character-literalsII`](https://github.com/johnno1962/swift/tree/character-literalsII)

This comment has been minimized.

@lattner

lattner Jan 16, 2019

Collaborator

Is the implementation still WIP or does it implement this as described? If it is implemented for real, please drop WIP

This comment has been minimized.

@benrimmington

benrimmington Jan 16, 2019

Collaborator
* Implementation: [apple/swift#21873](https://github.com/apple/swift/pull/21873)

This comment has been minimized.

@kelvin13

kelvin13 Jan 16, 2019

Author Contributor

tagging @johnno1962

Show resolved Hide resolved proposals/0233-codepoint-and-character-literals.md Outdated
Show resolved Hide resolved proposals/0233-codepoint-and-character-literals.md Outdated
Show resolved Hide resolved proposals/0233-codepoint-and-character-literals.md Outdated
@natecook1000
Copy link
Member

natecook1000 left a comment

Just a few notes — excited about this progress!

Show resolved Hide resolved proposals/0233-codepoint-and-character-literals.md Outdated
Show resolved Hide resolved proposals/0233-codepoint-and-character-literals.md Outdated
Show resolved Hide resolved proposals/0233-codepoint-and-character-literals.md Outdated

kelvin13 added some commits Jan 16, 2019

@johnno1962

This comment has been minimized.

Copy link
Contributor

johnno1962 commented Jan 16, 2019

Implementation just passed the source compatibility tests so you can remove the “work in progress"

@lattner

This comment has been minimized.

Copy link
Collaborator

lattner commented Jan 18, 2019

Awesome. Please @mention me when you're ready to go.

@kelvin13

This comment has been minimized.

Copy link
Contributor Author

kelvin13 commented Jan 21, 2019

@lattner i think this is ready for review

@lattner

This comment has been minimized.

Copy link
Collaborator

lattner commented Jan 26, 2019

Thanks, and sorry for the delay. I'll try to find a review manager.

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