[swift-users] swift 4 compiler error tuple parameter does not support destructing

CK TUNG cktung at mac.com
Thu Jun 29 22:35:56 CDT 2017

Many thanks.  It works in Swift 4 Xcode 9 beta2.

On Jun 30, 2017, at 11:20 AM, Daniel Dunbar <daniel_dunbar at apple.com> wrote:

This is due to SE-0110:
but see the additional commentary:

For now you can rewrite it as:
let filenamelength = bytes
  .map {
    let (index, element) = $0
    return Int(Double(element) * pow(256,Double(index))) }
  .reduce(0, +)

 - Daniel

On Jun 29, 2017, at 8:08 PM, CK TUNG via swift-users <swift-users at swift.org> wrote:
I have the following code snippet that compile OK in swift 3

            bytes = Array(UnsafeBufferPointer(....))
            let filenamelength = bytes[(i+28)..<(i+28+2)]
                .map { (index, element) in return Int(Double(element) * pow(256,Double(index))) }
                .reduce(0, +)
I have the following code snippet that compile OK in swift 3
In Swift 4 (Xcode beta1) it compiled with error something like "... too complex"
Now in Swift 4 Xocde beta2 the error is tuple parameter element does not support destructing
what has been changed in swift 4 ?

Please help how to solve it ?


swift-users mailing list
swift-users at swift.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170630/7301278a/attachment.html>

More information about the swift-users mailing list