[swift-evolution] SE-0023 API Design Guidelines: Mutating vs Functional

T.J. Usiyan griotspeak at gmail.com
Mon Jan 25 00:12:02 CST 2016


'Functional' is pretty vague in this context. Mutating cuts to
differentiating trait.

"A function produces something" can fall down if I have a function with
side effects.

``` swift
private var state = 0
func generateCount() -> String {
    state += 1
    return "I've been called \(state) times"
}
```

We could narrow it by saying that a pure function has no side effects but
this just draws us further from the relevant point, in my opinion.


On Sun, Jan 24, 2016 at 7:09 PM, Erica Sadun via swift-evolution <
swift-evolution at swift.org> wrote:

> I'm finding the thread on the SE-0023 Review overwhelming. I'm starting a
> new thread and I'm including a link to a write-up of why I believe naming
> is better served with functional/procedural differentiation over
> mutating/non-mutating.
>
> https://github.com/erica/SwiftStyle/blob/master/Grammatical.md
>
> If I have not addressed any of Dave's concerns, I will be happy to update
> this.
>
> -- Erica
>
>
> _______________________________________________
> 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/20160125/cf1d450e/attachment.html>


More information about the swift-evolution mailing list