Swift: inductively-defined function argument/return types
| Originator: | rix.rob | ||
| Number: | rdar://19235606 | Date Originated: | 12-Dec-2014 02:39 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 6.1.1 (6A2008a) |
| Classification: | Enhancement | Reproducible: | Always |
Summary: Dear Swift team, I hope this radar finds you well ❤️ See rdar://19235463 for context re: tuple types. All of that applies to function arguments, quite directly, but also to returns, in two senses: 1. When returning a tuple type—again, this is basically the tuple case so I won’t address it in this radar. 2. When using curried functions, e.g. T -> U -> V You can see this by writing curry/uncurry functions. Curry can’t be defined over an arbitrary number of arguments, and uncurry can’t be defined over a arbitrary number of returns. So you get to write binary curry; ternary curry; quaternary curry; etc. The splat syntax might apply nicely for curried function types: T -> *U // “*U” meaning “splat the returns of U” But that might also be ambiguous (whether to the compiler or to the reader/writer) with T -> (*U) which has a definition under the previous radar. I used up all of my reserves of creativity in the last radar so I’m afraid you’re on your own here :) I could see this being a more marginal use case, but it would be helpful in my framework Prelude[1] where I have implemented curry/uncurry for binary and ternary functions[2] and will probably implement them for quaternary functions sooner or later because that’s just the sort of thing I do. Steps to Reproduce: N/A Expected Results: N/A Actual Results: N/A Regression: N/A Notes: 1: https://github.com/robrix/Prelude 2: https://github.com/robrix/Prelude/blob/master/Prelude/Curry.swift
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!