Objective–C: Add something similar to C++’s `auto` keyword
| Originator: | daniel | ||
| Number: | rdar://21765475 | Date Originated: | 2015-07-10 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7 (7A152u) |
| Classification: | Enhancement | Reproducible: | Does not apply |
Summary: With the new lightweight generics in Objective–C, the types of the foundation containers — especially dictionaries — become quite a burden. When using Objective-C++, a lot of this pain can be alleviated by use of C++’s `auto` keyword, but for pure Objective–C, this is currently not an option. Although use of `auto` with Objective–C generics has a couple of limitations in its current form — more radars forthcoming — it’s better than nothing already. Come to speak of it, using `let` and `variable` to define type–inferred local symbols, would be even better than just hoisting over `auto` from C++–land. Steps to Reproduce: Doesn’t really apply… Expected Results: Doesn’t apply either… Actual Results: Doesn’t apply either… Version: Notes: Configuration: Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Apple Developer Relations13-Jul-2015 09:18 PM
There are no plans to address this based on the following:
The C type system is hostile to this, because things like "auto x = 42" will not produce an NSInteger, among many other problems.
We are now closing this report.
If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.
Please be sure to regularly check new Apple releases for any updates that might affect this issue.