[swift-evolution] [Pitch] Support for pure functions. Part n + 1.
Charles Srstka
cocoadev at charlessoft.com
Fri Feb 17 01:26:51 CST 2017
On Feb 16, 2017, at 1:27 PM, Sean Heber via swift-evolution <swift-evolution at swift.org> wrote:
>
> Doesn’t this break down if you can pass a reference as a parameter to a pure function? If that’s not allowed, I guess I must have missed it. Also this seems to require the function has a return value. I suppose generally a pure function without a return value wouldn’t make much sense - unless you pass it a reference.
Not only that, but even if you pass a value type as a parameter, that value type might have reference types as ivars. So since any call to any reference type can potentially mutate it, and any call to any value type could call through to a reference type which might then be mutated, it does seem that purity is quite difficult to guarantee.
Charles
More information about the swift-evolution
mailing list