[swift-evolution] [Pitch] Support for pure functions. Part n + 1.

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Feb 17 10:33:49 CST 2017


Regardless the issue you described with rethrows couldn’t we simply explicitly tell the compiler the closures type which would include the pure arrow?

let _: (T) ~> SomeType = { … }

That is similar to the behavior we now have with IUOs. (let myView: UIView = self.view inside UIViewController on iOS)

I don’t know if the tilde is heavily used in any other programming patterns and might create confusion here, but from the aesthetic point of view I’d prefer ~> over =>.



-- 
Adrian Zubarev
Sent with Airmail

Am 17. Februar 2017 um 15:37:15, Matthew Johnson via swift-evolution (swift-evolution at swift.org) schrieb:

Also, what about pure closures that have no need to state a signature because it is inferred?  This syntactic sugar is a pretty important aspect of Swift and often times some of our smallest closures will be pure.  For example Array’s map should be pure when the closure is pure and many map closures are very small.  We don’t want to have to annotate these closures with a signature.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170217/fd274142/attachment.html>


More information about the swift-evolution mailing list