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

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Feb 17 11:36:56 CST 2017


That problem could be solved with the combining tilde, however it isn’t easy, because it’s simply not easy to type. If ~> would describe the pure function and -> an impure function then the combination of both would be ≃>.

One thing I noticed, you said that the function itself will become pure or impure depending on the other function. Doesn’t this imply that -> is exactly this pure OR impure function. It’s either or but never both right? Otherwise it might lead us to a huge breaking change. A suggestion building on top of the arrow syntax we could have:

pure function: ~>
impure function: ≈> (That’s a ‘double tilde’)
pure or impure function: -> (it is as to top and bottom tilde was merged and smoothed together)


-- 
Adrian Zubarev
Sent with Airmail

Am 17. Februar 2017 um 17:43:21, Matthew Johnson (matthew at anandabits.com) schrieb:

Well sure, but then you have just supplied the type annotation.  I am describing a specific scenario where an API can accept a function that is pure or a function that is impure and will have the purity of the function passed into it.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170217/ca31147b/attachment.html>


More information about the swift-evolution mailing list