4 ms·
What was the motivation for `callAsFunction`? It's a toy example so `Dice(...)` is clearly bad compared to `Dice.roll(...)` but what's an example where it bring
by ollysb 7y ago
What was the motivation for `callAsFunction`? It's a toy example so `Dice(...)` is clearly bad compared to `Dice.roll(...)` but what's an example where it brings clarity over the alternative?
- jshier 7y agoYou can read the motivation in the evolution proposal: https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md https://github.com/apple/swift-evolution/blob/master/proposa...
- ollysb 7y agoThe first example with polynomials could be achieved using closures already. Type erasure on closure contexts seems unfortunate and fixing that seems like a better long term solution (granted it's probably far harder to solve). Was excited to see talk of ML though :)