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

Florent Vilmart florent at flovilmart.com
Fri Feb 17 13:03:18 CST 2017


I'm really not sold about the ~> operator, as it would be easy to miss. Swift is known and loved for the expressiveness of the language, using that operator doesn't help with that.

On another hand, I agree that this is the sexiest, less intrusive solution.

On 17 févr. 2017 13:36 -0500, Adrian Zubarev via swift-evolution <swift-evolution at swift.org>, wrote:
> My suggestion is that -> would be the conditional arrow that can be both pure or impure. That would make @pure func foo(_ f: @pure (Int) -> Int) -> Int equivalent to func foo(_ f: (Int) ~> Int) -> Int. Plus depending on the implementation the compiler might be able to help and tell you that foo could use ~> instead.
>
>
> --
> Adrian Zubarev
> Sent with Airmail
>
> Am 17. Februar 2017 um 19:25:41, Anton Zhilin (antonyzhilin at gmail.com) schrieb:
> > Just let
> >
> > @pure func foo(_ f: (Int) -> Int) -> Int
> >
> > be the same as those two combined:
> >
> > @pure func foo(_ f: @pure (Int) -> Int) -> Int
> > func foo(_ f: (Int) -> Int) -> Int
> >
> > No need for anything like “re-pure” or ≃>.
> >
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170217/b35cd388/attachment.html>


More information about the swift-evolution mailing list