# Is this a valid @pure function?

**URL:** https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577
**Category:** Performance
**Tags:** question
**Created:** [November 15, 2018, 8:20pm UTC](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577 "2018-11-15T20:20:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)
#### Post date: [November 15, 2018, 8:20pm UTC](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577/1 "2018-11-15T20:20:40Z")

</div>

Hi julia pros,

is the following function safe to be annotated with @pure?

```julia
Base.@pure getParameters(t::Type) = Tuple{t.parameters...}

```

it would be soo awesome, because this indeed supports type inference

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [November 15, 2018, 8:33pm UTC](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577/2 "2018-11-15T20:33:11Z")

</div>

I’d say “yes”.

(I’d also say the function should be named `getparameters` or `get_parameters`.)

---

<div class="post-metadata">

### Author: ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)
#### Post date: [November 15, 2018, 8:36pm UTC](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577/3 "2018-11-15T20:36:41Z")

</div>

thanks a lot,

(the name just came from my daily Scala work… of course in julia style guide your suggestions or e.g. `parametersof` are preferable)

awesome!!!

---

<div class="post-metadata">

### Author: ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)
#### Post date: [November 16, 2018, 4:58pm UTC](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577/4 "2018-11-16T16:58:51Z")

</div>

I believe the function should infer fine without `@pure` also.
