# \[Pitch\] Destructuring Assignment of Structs and Classes

**URL:** <https://forums.swift.org/t/pitch-destructuring-assignment-of-structs-and-classes/51593>\
**Category:** Pitches\
**Created:** [August 29, 2021, 8:40pm UTC](https://forums.swift.org/t/pitch-destructuring-assignment-of-structs-and-classes/51593 "2021-08-29T20:40:22Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Max\_Desiatov](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/max_desiatov/32/20654_2.png) [@Max\_Desiatov](https://forums.swift.org/u/Max_Desiatov)\
**Post date:** [August 30, 2021, 12:41pm UTC](https://forums.swift.org/t/pitch-destructuring-assignment-of-structs-and-classes/51593/16 "2021-08-30T12:41:34Z")

</div>

This was discussed in [a previous thread](https://forums.swift.org/t/record-initialization-and-destructuring-syntax/16631/60), and our consensus was that [the closure capture list syntax](https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html#ID56) would work best for this. For example

```swift
final class C {}

struct Car {
    let make: String
    let model: String
    let year: Int
    let reference: C
}

let car = Car(make: "Honda", model: "E", year: 2021, reference: C())

let [make, model, year] = car

```

This would allow for binding to different names and also `weak` and `unowned` modifiers. This would also be less invasive to the parser I hope, since you'd be able to use parts of the grammar dedicated to capture lists:

```swift
var [weak weakReference = reference] = car

```

Alternatively, it could look closer to the dictionary syntax:

```swift
var [weak weakReference: reference] = car

```

---

_[View the full topic](https://forums.swift.org/t/pitch-destructuring-assignment-of-structs-and-classes/51593)._
