Swift: Implementation details must be exposed in return types

Originator:rix.rob
Number:rdar://17499576 Date Originated:29-Jun-2014 02:23 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode6-Beta2 (6A216f)
Classification:Serious Bug Reproducible:Always
 
Summary:
I’m defining the cartesian product of two sequences; if these have element types X and Y, then the returned value is a (lazy) sequence of tuple type (X, Y).

I don’t want to expose the implementation details to the consumer of the API; I want them to know that it returns a Sequence whose element type is (X, Y). Therefore, I try to define it thus:

func * <A : Sequence, B : Sequence, C : Sequence where C.GeneratorType.Element == (A.GeneratorType.Element, B.GeneratorType.Element)> (a: A, b: B) -> C {
…
}

However, you can’t relate C’s element type through a tuple—which seems like a bug in its own right.

I’m therefore forced to put implementation details in the return type:



Steps to Reproduce:
In numbered format, detail the exact steps taken to produce the bug.

Expected Results:
Describe what you expected to happen when you executed the steps above.

Actual Results:
Explain what actually occurred when steps above were executed.

Regression:
Describe circumstances where the problem occurs or does not occur, such as software versions and/or hardware configurations.

Notes:
Provide additional information, such as references to related problems, workarounds and relevant attachments.

Comments

This should be deleted; it was unfinished and I posted it accidentally.


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!