# The Future of @testable

**URL:** <https://forums.swift.org/t/the-future-of-testable/9655>\
**Category:** Discussion\
**Tags:** implementers-needed\
**Created:** [February 7, 2018, 7:54am UTC](https://forums.swift.org/t/the-future-of-testable/9655 "2018-02-07T07:54:11Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Joe\_Groff](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/joe_groff/32/1929_2.png) [@Joe\_Groff](https://forums.swift.org/u/Joe_Groff)\
**Post date:** [February 15, 2018, 6:36pm UTC](https://forums.swift.org/t/the-future-of-testable/9655/14 "2018-02-15T18:36:01Z")

</div>

`@testable` is best understood as a hack because, IMO, the idea of tests being a separate build product fundamentally runs against the nature of a language with access control. Tests ought to be treated as a fundamental part of the code they validate, just like types are. I would like to see the Swift ecosystem eventually evolve support for tests that sit alongside implementation, much like how they do in the D programming language:

> **[Unit Tests - D Programming Language](https://dlang.org/spec/unittest.html)**
>
> D Programming Language

In D, a `unittest` block can appear almost anywhere, and naturally has access to everything in that scope, and the compiler supports conditionally compiling all the `unittest` blocks so that they can be run in debug builds. This would be a large paradigm shift from what XCTest and Xcode support today in the Swift ecosystem, which is why `@testable` exists as a stopgap, but I don't think we'll really reach a satisfying testing story by making incremental changes to how `@testable` works. I believe the D model would fit much more naturally into how Swift as a language is designed.

---

_[View the full topic](https://forums.swift.org/t/the-future-of-testable/9655)._
