[swift-evolution] Swift should support generics as arguments to closures in any context

Brent Royal-Gordon brent at architechies.com
Fri Jan 15 17:22:21 CST 2016


> there isn't a good way to tell the compiler that a closure parameter must belong to more than one protocol, or a type plus a protocol.

There is a way to do two protocols:

	protocol A {}
	protocol B {}
	let closure: (protocol<A, B> -> Void) = { _ in }

I think this should probably be extended to allow one of the listed protocols to be a class. (There's no need to support structs or enums, since you know their conformances.)

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list