Swift typealias/generics protocol dichotomy is very confusing

Originator:dan.abramov
Number:rdar://17300839 Date Originated:06/13/14
Status: Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
 
Summary:
As a C# programmer with some (little) experience in functional languages (F#, a little SML), I find typealias/generics dichotomy in protocols confusing.

Related:

https://devforums.apple.com/thread/230611?tstart=0
http://stackoverflow.com/questions/24137062/how-do-i-return-a-sequence-in-swift
http://schani.wordpress.com/2014/06/11/associated-types-considered-weird/

SequenceOf feels very hackish.

If you're sure about this direction, please document the hell out of it.
It doesn't help that Swift library is closed source and I can't learn from it.

Steps to Reproduce:
1. Try to write a generator function
2. Try to make it compile

Expected Results:
It's cool and the signature makes sense

Actual Results:
I have to use SequenceOf. This is just as annoying as early C# versions where we had to create delegate types.

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!