-1 here. What's wrong with tuples? Don't kill functional approach On Wed, 28 Dec 2016 at 19:35 Micah Hainline via swift-evolution < [email protected]> wrote:
> You haven't really explained what problem this solves, and it would have > to be a pretty big one to justify such a change. > > I'm -1 on this, until a compelling argument is made. This feels like just > liking the syntax of another language and wanting it in Swift. > > On Dec 28, 2016, at 5:09 AM, Anton Zhilin via swift-evolution < > [email protected]> wrote: > > Some people on the list wondered, why we have moved from tuples in > function parameters, but multiple returns are still implemented using > tuples? The following code still compiles: > > > func position() -> (x: Int, y: Int) { > > return (x: 0, y: 0) > > } > > > > let (y, x) = position() > > > > (Maybe it’s a bad example, because naturally we’d use Point struct. Let’s > pretend those two parameters don’t make sense as a struct.) > > > What I want to discuss is if we should introduce out parameters *and* > make them the default for multiple returns for Swift 4. The syntax would > look like: > > > func position(x: out Int, y: out Int) { > > x = 0 > > y = 0 > > } > > > > var y > > position(x: let x, y: y) > > > > out arguments can be any patterns allowed on the left side of assignment, > including wildcard pattern and tuple destructuring pattern. > > > > > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution > > _______________________________________________ > > swift-evolution mailing list > > [email protected] > > https://lists.swift.org/mailman/listinfo/swift-evolution > >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
