# It it possible to specify a returned non-copyable value as borrowed?

**URL:** <https://forums.swift.org/t/it-it-possible-to-specify-a-returned-non-copyable-value-as-borrowed/77761>\
**Category:** Using Swift\
**Created:** [February 9, 2025, 6:40pm UTC](https://forums.swift.org/t/it-it-possible-to-specify-a-returned-non-copyable-value-as-borrowed/77761 "2025-02-09T18:40:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jamieQ](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jamieq/32/5117_2.png) [@jamieQ](https://forums.swift.org/u/jamieQ)\
**Post date:** [February 10, 2025, 3:58am UTC](https://forums.swift.org/t/it-it-possible-to-specify-a-returned-non-copyable-value-as-borrowed/77761/2 "2025-02-10T03:58:35Z")

</div>

i don't have much 'real world' experience with noncopyable types, so i may be off here, but i _think_ if you can tolerate the use of underscored (yet longstanding) [stdlib APIs](https://github.com/swiftlang/swift/blob/022596473f967d7d0104d1f7289d3ad754edb0cf/include/swift/AST/AccessorKinds.def#L148-L154), or [experimental features](https://forums.swift.org/t/pitch-modify-and-read-accessors/75627), then this can perhaps be achieved by use of the `_read`/`read` coroutine accessor.

e.g. if i modify your code as so:

```swift
struct B: ~Copyable {
    
    let stored = A()
    
    var computed: A { 
        _read { yield A() }
    }
    
}

```

then i get the error:

```swift
13 | func hello(b: borrowing B) {
14 | let y = b.stored // disallowed: 'b' is borrowed and cannot be consumed
15 | let z = b.computed // allowed
   | |- error: 'b.computed' is borrowed and cannot be consumed
   | `- note: consumed here
16 | }
17 | 

```

---

_[View the full topic](https://forums.swift.org/t/it-it-possible-to-specify-a-returned-non-copyable-value-as-borrowed/77761)._
