# \`@nospecialize\` on type parameter

**URL:** <https://discourse.julialang.org/t/nospecialize-on-type-parameter/117071>\
**Category:** General Usage\
**Created:** [July 15, 2024, 8:41pm UTC](https://discourse.julialang.org/t/nospecialize-on-type-parameter/117071 "2024-07-15T20:41:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [July 15, 2024, 8:41pm UTC](https://discourse.julialang.org/t/nospecialize-on-type-parameter/117071/1 "2024-07-15T20:41:51Z")

</div>

This is mostly out of curiosity: Say that I have a struct with a lot of type parameters. One of those parameters changes each run, and I don’t want to specialize on it. Is there any way I can get something like the following to work?

```julia
function f(x::Array{@nospecialize(T),N}) where {T,N}
    return x
end

```

In other words, I want to do codegen for each new `N`, but _not_ for each new eltype `T`.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [July 15, 2024, 8:55pm UTC](https://discourse.julialang.org/t/nospecialize-on-type-parameter/117071/2 "2024-07-15T20:55:18Z")

</div>

No, not yet anyhow. See [Function over-specialization on unused parts of types · Issue #26834 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/26834)
