Swift 2: The removal of free functions from stdlib exacerbates the pain of constructors not being functions
| Originator: | rix.rob | ||
| Number: | rdar://21295228 | Date Originated: | 08-Jun-2015 11:55 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-7-beta (7A120f) |
| Classification: | Other Bug | Reproducible: | Always |
Summary: toString is gone, and I can’t use `String` to name the overloaded set of constructor functions for String (including the one equivalent to toString, String.init<T>(T)), so there’s no longer a symbol available to pass to higher-order functions like map. That in turn means that I have to introduce a closure which introduces unnecessary cognitive load—I now have to consider its scope, whether it captures, the names of its parameters, and all of this distracts from the clarity of what would otherwise things.map(toString). This is true for Swift’s inits and enum cases, as well as properties; being able to retrieve these things as functions—which is what they _are_!—syntactically makes them vastly more useful, and readable. It also makes for less compiler work since you don’t have to worry about optimizing those tedious closures away. I’m just saying, you could have a margarita on the beach instead. Steps to Reproduce: N/A Expected Results: N/A Actual Results: N/A Regression: N/A Notes: N/A
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!