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-238] Support throwing subscripts #42860

swift-ci opened this issue Dec 15, 2015 · 2 comments

[SR-238] Support throwing subscripts #42860

swift-ci opened this issue Dec 15, 2015 · 2 comments


Copy link

swift-ci commented Dec 15, 2015

Previous ID SR-238
Radar None
Original Reporter anviking (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 24
Labels Improvement, LanguageFeatureRequest
Assignee @theblixguy
Priority Medium

md5: d1f830bfd05395ee30fb2819cb12b391

relates to:

  • SR-115 Support generic constraints in subscripts

Issue Description:

Support for throwing subscripts would together with generic ones be really nice for JSON mapping/deserializing libraries like mine It would make subscripts an alternative to custom operators.

For example:
subscript<T: SomeProtocol>(key: String) throws -> T

Would most likely be useful on its own for a lot of other things as well.

Copy link

theblixguy commented Apr 11, 2019

There is now a WIP implementation that supports throwable getters and setters which can be used inside both computed properties and subscripts. There's still a bit of work left, but hopefully it should be finished soon: #22749

Copy link

xAlien95 commented Jul 7, 2021

Throwing subscripts are available in Swift 5.5 due to SE-0310 Effectful Read-only Properties. Should this issue be marked as resolved?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

4 participants