# Source location of e.g. \`struct\` definition

**URL:** <https://discourse.julialang.org/t/source-location-of-e-g-struct-definition/35885>\
**Category:** General Usage\
**Created:** [March 12, 2020, 3:17pm UTC](https://discourse.julialang.org/t/source-location-of-e-g-struct-definition/35885 "2020-03-12T15:17:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![goretkin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goretkin/32/167_2.png) [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Post date:** [March 12, 2020, 3:17pm UTC](https://discourse.julialang.org/t/source-location-of-e-g-struct-definition/35885/1 "2020-03-12T15:17:13Z")

</div>

What’s a way to get the sourcecode location of a struct definition?

```julia
julia> which(Rational, (Int64, Int64))
(::Type{Rational})(n::T, d::T) where T<:Integer in Base at rational.jl:21

julia> which(Main, :Rational)
Base

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 13, 2020, 8:57am UTC](https://discourse.julialang.org/t/source-location-of-e-g-struct-definition/35885/2 "2020-03-13T08:57:22Z")

</div>

AFAIK there is no functionality for this yet, but you can try the constructor which may just take you to the `struct` if there are no outer constructors, or it will be really close for most code. Eg

```julia
@edit Rational(1, 1)

```

(in your example, you are after the outer constructor anyway)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 13, 2020, 8:58am UTC](https://discourse.julialang.org/t/source-location-of-e-g-struct-definition/35885/3 "2020-03-13T08:58:21Z")

</div>

Cf

[https://github.com/JuliaLang/julia/issues/14356](https://github.com/JuliaLang/julia/issues/14356)
