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

[SR-3460] Replace _AnyHashable protocol with a generic subscript #46048

Closed
airspeedswift opened this issue Dec 19, 2016 · 6 comments
Closed

[SR-3460] Replace _AnyHashable protocol with a generic subscript #46048

airspeedswift opened this issue Dec 19, 2016 · 6 comments
Assignees
Labels
affects ABI Flag: Affects ABI improvement standard library Area: Standard library umbrella

Comments

@airspeedswift
Copy link
Member

Previous ID SR-3460
Radar rdar://problem/31411209
Original Reporter @airspeedswift
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement, AffectsABI
Assignee @airspeedswift
Priority Medium

md5: 945fe94ade9f9a0144335bf92d3ff4be

is blocked by:

  • SR-115 Support generic constraints in subscripts

Issue Description:

Currently, implicit conversion to a dummy _AnyHashable existential is being used as a workaround for being able to use any Hashable type as a key into a dictionary of AnyHashable

If generic subscripts are implemented, these could be eliminated.

@slavapestov
Copy link
Member

I didn't realize the goal was to remove the implicit conversion. Recently I made a patch to remove the subscript instead since it seemed redundant. But we could put them back, and disable the implicit conversion in Swift 4 mode. This would require an evolution proposal though. Is this still something you want to pursue or shall we just close this?

@swift-ci
Copy link
Collaborator

Comment by Andrew Pleshkov (JIRA)

I have a question about AnyHashable:
Found it's ok to use it as a function argument type and swift implicitly boxes any Hashable I provide there (like it does for dictionaries).
Can I be sure in such behaviour?

func foo(_ a: AnyHashable) {
    print(a)
}

foo(1) // compiles
foo("lol") // compiles
$ swift --version
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9

@swift-ci
Copy link
Collaborator

Comment by Andrew Pleshkov (JIRA)

above question is answered in SR-4273, see comments

@bob-wilson
Copy link

@swift-ci create

@beccadax
Copy link
Contributor

beccadax commented May 9, 2017

It looks like these APIs are gone as of 66bcf5b. Should we close this bug, or is there more to do here?

@airspeedswift
Copy link
Member Author

Yeah, this is resolved. Will mark closed.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects ABI Flag: Affects ABI improvement standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

5 participants