# Pitch: Introduce #module to get the current module name

**URL:** <https://forums.swift.org/t/pitch-introduce-module-to-get-the-current-module-name/45806>\
**Category:** Pitches\
**Created:** [March 17, 2021, 9:40am UTC](https://forums.swift.org/t/pitch-introduce-module-to-get-the-current-module-name/45806 "2021-03-17T09:40:50Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![johannesweiss](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/johannesweiss/32/38183_2.png) [@johannesweiss](https://forums.swift.org/u/johannesweiss)\
**Post date:** [March 17, 2021, 10:13am UTC](https://forums.swift.org/t/pitch-introduce-module-to-get-the-current-module-name/45806/5 "2021-03-17T10:13:04Z")

</div>

> [@krzyzanowskim](#):
>
> I'm thinking about "ThisModule.Foo" vs "NamedModule.Foo" vs "Foo".

I see. I think there's room for both tbh! `#module` is important because the `#magicIdentifiers` are the one place where you can get information from your caller.

Ie. if say we have two modules: `App` and `Framework`. If in the `Framework` module we have:

```swift
public func printCallerModule(_ module: String = #module) {
    print(module)
}

```

And in `App` we do

```swift
import Framework

printCallerModule()

```

Then it will print `App` because the `#magicIdentifiers` get evaluated in the caller's context. If we had a (hypothetical) `Module.Type` and did `public func printCallerModule(_ module: String = "\(Module.Type)")` then the above would print `Framework` which isn't what we need.

---

_[View the full topic](https://forums.swift.org/t/pitch-introduce-module-to-get-the-current-module-name/45806)._
