# ~Copyable: what is it good for?

**URL:** <https://forums.swift.org/t/copyable-what-is-it-good-for/68879>\
**Category:** Using Swift\
**Created:** [December 7, 2023, 10:36pm UTC](https://forums.swift.org/t/copyable-what-is-it-good-for/68879 "2023-12-07T22:36:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![taylorswift](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/taylorswift/32/43413_2.png) [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Post date:** [December 8, 2023, 1:40am UTC](https://forums.swift.org/t/copyable-what-is-it-good-for/68879/3 "2023-12-08T01:40:21Z")

</div>

i found one really hacky way to get this working:

```swift
struct Server:~Copyable
{
    private
    let loop:ServerLoop
    let state:Server.State
}
extension Server
{
    var count:Counters
    {
        _read { yield self.loop.count }
    }
}

```

the compiler admits it doesn’t know how to compile this.

```plaintext
copy of noncopyable typed value. This is a compiler bug. Please file a bug with a small example of the bug

```

but i managed to trick it into compiling it anyway using immediately-executed closures.

```swift
let n:Int =
{
    (count:borrowing Counters) in

    count.foosBarred.load(ordering: .relaxed)

} (server.count)

```

who knows what [demons](https://forums.swift.org/t/capturing-a-noncopyable-type-in-an-async-closure/68118/5) i may have [unleashed](https://forums.swift.org/t/what-could-cause-swift-release-dealloc-to-segfault/68506/6) by doing this…

perhaps `~Copyable` is not ready for prime time.

---

_[View the full topic](https://forums.swift.org/t/copyable-what-is-it-good-for/68879)._
