[swift-evolution] Lambda function syntax

Brent Royal-Gordon brent at architechies.com
Thu Dec 24 06:38:37 CST 2015


> I'm completely against replacing '->' by ':' it would make unreadable the declaration of a function taking a closure as parameter, or returning one (among other things).

Actually, I find this perfectly readable, though a little bit strange after so long with the current signatures:

	func indexOf(predicate: Element: Bool): Index? {
		for (i, elem) in zip(indexes, self) {
			if predicate(elem) {
				return i
			}
		}
		return nil
	}

Where I *do* foresee big issues is with tuples. Take a look at this declaration:

	let tuple: (Int: Int, Bool: Bool)

Does `tuple` contain two unlabeled functions, or two labeled values?

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list