Re: [swift-evolution] Idea: "pure" keyword for function signatures

2017-05-26 Thread Michael Savich via swift-evolution
The breakdown of purity in D is very interesting. In D, a pointer that is marked as constant means the memory it points to is considered constant. One of the issues raised is that Swift does not have that “transitive immutability”, which limits what the compiler can infer. I can see how that wou

Re: [swift-evolution] Idea: "pure" keyword for function signatures

2017-05-25 Thread Xiaodi Wu via swift-evolution
This is a topic of considerable history. See: https://lists.swift.org/pipermail/swift-evolution/ Week-of-Mon-20151214/003684.html https://lists.swift.org/pipermail/swift-evolution/ Week-of-Mon-20151221/003900.html https://lists.swift.org/pipermail/swift-evolution/ Week-of-Mon-20160104/006005.html

[swift-evolution] Idea: "pure" keyword for function signatures

2017-05-25 Thread Michael Savich via swift-evolution
Writing functions without side effects is generally considered to result in less error-prone code. In Swift today, if you want to segment your code into pure and impure functions, you just have to police yourself, which is a very un-Swifty thing to have to do. This problem is compounded when wor