> On Feb 13, 2017, at 4:03 PM, Dan Stenmark via swift-evolution 
> <[email protected]> wrote:
> 
> 
> let (quotient, remainder) = 17 / 5
> print( "Q:\(quotient) R:\(remainder)" )    // Idiot-proof!


This would seem pretty reasonable to me if instead of a tuple, it returned a 
Rational struct where Int(_ rational: Rational) would do what “17 / 5” does 
right now. In this case you could have the hint provided by the extra “Int(…)” 
and an error if you missed it, but with less verbiage. The compiler could (in 
theory) skip the remainder calculation if you never accessed the remainder.

-tim

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to