[swift-evolution] [Pitch] Support for pure functions. Part n + 1.
griotspeak at gmail.com
Fri Feb 17 13:26:25 CST 2017
There shouldn't be a need for a third arrow with regard to purity. Impure
encompasses pure in that there is simply no guarantee of purity with an
impure function. You should be able to use a pure function in place of an
impure function without any issue whatsoever.
On Fri, Feb 17, 2017 at 1:35 PM, 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)
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution