-
Couldn't load subscription status.
- Fork 10.6k
[SE-0494][StdLib] Add isTriviallyIdentical(to:) Methods to String and Substring
#82055
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
base: main
Are you sure you want to change the base?
Conversation
b140d00 to
7634c46
Compare
isIdentical Methods for Quick Comparisons to String and SubstringisIdentical Methods for Quick Comparisons to String and Substring
|
@lorentey No big rush… but if you had any advice about these implementations that would be a big help. I'm planning to post another pitch to swift forums on monday. It's just a pitch thread… so it's not blocked on implementation diffs. I would expect at least one more week before I would have some more implementations for the rest of the types to unblock a proposal review thread. |
7462596 to
e6db03f
Compare
isIdentical Methods for Quick Comparisons to String and SubstringisIdentical Methods for Quick Comparisons to String and Substring
09d49a8 to
56da8c0
Compare
3a0f013 to
2b63da1
Compare
d26fa93 to
753979f
Compare
753979f to
e0a2726
Compare
isIdentical Methods for Quick Comparisons to String and SubstringisTriviallyIdentical(to:) Methods for Quick Comparisons to String and Substring
e0a2726 to
e694f86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(In hindsight, we should've proposed adding the same methods to [Sub]String.UnicodeScalarView as well -- the scalar views are supposed to be fully formed string types. Oh well, there is always tomorrow!)
@lorentey No… we did actually add |
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
| tags: [.validation, .String])) | ||
| } | ||
|
|
||
| if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorentey I think this is the right way to guard from benchmarks… and then we have to go in and change this after 6.3 goes live to prod?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we have SwiftStdlib 6.3 that you should use instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Azoy I'm pretty sure I tried that before… but SwiftStdlib 6.3 was not available from benchmarks. Was there a recent change to support that?
|
@swift-ci Please smoke test |
isTriviallyIdentical(to:) Methods for Quick Comparisons to String and SubstringisTriviallyIdentical(to:) Methods to String and Substring
|
@swift-ci Please smoke test |
|
@swift-ci Please smoke test |
|
@lorentey Something that's not totally clear to me is when new test cases should go under |
Background
SE-0494
We propose new
isTriviallyIdentical(to:)instance methods to the following concrete types for determining in constant-time if two instances must be equal by-value:Instead of “one big diff”… we can try and keep the diffs grouped together by similar functionality:
Changes
String
We already expose a public-but-underscored method on
Stringto return identity equality.1 We can add a new public-and-supported method:What happens to the existing underscored method?
For now… we don't need to have a strong opinion about the underscored method. The underscored method is
alwaysEmitIntoClientand already deploys back to earlier releases. Deleting the underscored method would then mean a breaking change for apps that already depend on the underscored method.Substring
We do not currently expose identity equality on
Substring. We can follow a similar pattern toString:Test Plan
New tests were added for
StringandSubstring.Benchmarks
New benchmarks were added for
StringandSubstring.Footnotes
https://github.com/swiftlang/swift/blob/swift-6.1.2-RELEASE/stdlib/public/core/String.swift#L397-L415 ↩