Swift 2b4: Indirect structs/properties
| Originator: | rix.rob | ||
| Number: | rdar://21926975 | Date Originated: | 21-Jul-2015 04:42 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A165t) |
| Classification: | Enhancement | Reproducible: | Always |
Summary:
Indirect enums are neat. Indirect structs would be valuable for cases where the recursion is via another enum which itself is non-recursive, like Optional. For example one could write List like so:
indirect struct List<T> {
let uncons: (T, List)?
}
or like so:
struct List<T> {
indirect let uncons: (T, List)?
}
As a more practical example of this, I often use a struct as the fixpoint of a non-recursive enum:
enum Expression<A> {
case Var(Int)
case App(A, A)
case Abs(Int, A)
}
struct Term {
// what I want to write:
// indirect let expression: Expression<Term>
// what I have to write:
let expression: Box<Expression<Term>>
// or:
let expression: () -> Expression<Term>
}
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!