# Getting the original name of structs

**URL:** <https://discourse.julialang.org/t/getting-the-original-name-of-structs/92757>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 10, 2023, 1:58pm UTC](https://discourse.julialang.org/t/getting-the-original-name-of-structs/92757 "2023-01-10T13:58:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lklein](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lklein](https://discourse.julialang.org/u/lklein)\
**Post date:** [January 10, 2023, 1:58pm UTC](https://discourse.julialang.org/t/getting-the-original-name-of-structs/92757/1 "2023-01-10T13:58:35Z")

</div>

I want to write a function `get_original_name(::DataType)` that returns the original name used when declaring a struct. Is there any way to do this? Is the original name even distinguishable from names that were added later?

```julia
struct A end
B = A
@assert get_original_name(B) == :(Main.A)

```

The goal is to define a function `get_original_name` so that, the assert is met.

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [January 10, 2023, 2:19pm UTC](https://discourse.julialang.org/t/getting-the-original-name-of-structs/92757/2 "2023-01-10T14:19:35Z")

</div>

You may use

```julia
julia> nameof(B)
:A

```

Although this strips the module

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [January 10, 2023, 3:01pm UTC](https://discourse.julialang.org/t/getting-the-original-name-of-structs/92757/3 "2023-01-10T15:01:17Z")

</div>

> [@lklein](#):
>
> ```julia
> struct A end
> B = A
> 
> ```

If you want the module as well:

```julia
julia> parentmodule(B)
Main

```
