# Get values of symbols inside a function

**URL:** <https://discourse.julialang.org/t/get-values-of-symbols-inside-a-function/848>\
**Category:** General Usage\
**Created:** [December 10, 2016, 4:26pm UTC](https://discourse.julialang.org/t/get-values-of-symbols-inside-a-function/848 "2016-12-10T16:26:35Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 11, 2016, 9:38am UTC](https://discourse.julialang.org/t/get-values-of-symbols-inside-a-function/848/25 "2016-12-11T09:38:22Z")

</div>

> [@mike](#):
>
> No idea, one of our compiler gurus would need to answer that one 😄

I moved this discussion out to a thread in the development category.

> [@Value type dispatch on constants](https://discourse.julialang.org/t/value-type-dispatch-on-constants/858):
>
> This is best explained by an example. type Test x::Vector{Float64} end import Base: getindex getindex(s::Test,sym::Symbol) = getindex(s,Val{sym}) getindex(s::Test,::Type{Val{:test\_sym}}) = reshape(view(s.x,1:9),3,3) function test\_dispatch(s) s[:test\_sym] end function test\_dispatch2(s) s[Val{:test\_sym}] end s = Test(collect(1:10)) @code\_llvm test\_dispatch(s) @code\_llvm test\_dispatch2(s) The first gives ; Function Attrs: uwtable define %jl\_value\_t\* @julia\_test\_dispatch\_63361(%jl\_valu…

---

_[View the full topic](https://discourse.julialang.org/t/get-values-of-symbols-inside-a-function/848)._
