Probably a compiler bug: can't convert Range<Int> to Sequence where Element == Int

The original language feature you were looking for doesn't exist yet, but we could call it "generic closures":

// Made-up syntax:
func iterateColumnsAlongGravity(
    using block: <S: Sequence> (_ indexes: S) -> () where S.Element == Int)

Unfortunately, this has all sorts of other implications (can I make arrays of these? can other values be generic besides closures?) that make it a "big" feature, and probably not something that'll happen any time soon. But I did want to point out that it's a possible feature.

See also: Enum with generic cases

3 Likes