# How to avoid compilation of an uncalled function

**URL:** <https://discourse.julialang.org/t/how-to-avoid-compilation-of-an-uncalled-function/100058>\
**Category:** General Usage\
**Tags:** compilation, precompilation, lazy-evaluation\
**Created:** [June 8, 2023, 3:55pm UTC](https://discourse.julialang.org/t/how-to-avoid-compilation-of-an-uncalled-function/100058 "2023-06-08T15:55:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![user664303](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/user664303/32/37843_2.png) [@user664303](https://discourse.julialang.org/u/user664303)\
**Post date:** [June 8, 2023, 5:39pm UTC](https://discourse.julialang.org/t/how-to-avoid-compilation-of-an-uncalled-function/100058/2 "2023-06-08T17:39:47Z")

</div>

You can use the `@nospecialize` macro at the beginning of the generated function, as follows:

```julia
macro valuedispatch_macro(lower::Int, upper::Int, val, fun)
    ex = valuedispatch_expr(Val(lower), Val(upper), esc(val), esc(fun))
    return quote
        @nospecialize
        $ex
        return nothing
    end
end

```

Because `valuedispatch_1_32` is now a generic function, it knows nothing about the function `myfun` being passed in, and so cannot precompile it.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-avoid-compilation-of-an-uncalled-function/100058)._
