# @static but do not parse the invalid branch

**URL:** https://discourse.julialang.org/t/static-but-do-not-parse-the-invalid-branch/898
**Category:** Offtopic
**Tags:** question
**Created:** [December 12, 2016, 7:28pm UTC](https://discourse.julialang.org/t/static-but-do-not-parse-the-invalid-branch/898 "2016-12-12T19:28:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tawheeler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tawheeler/32/17657_2.png) [@tawheeler](https://discourse.julialang.org/u/tawheeler)
#### Post date: [December 12, 2016, 7:28pm UTC](https://discourse.julialang.org/t/static-but-do-not-parse-the-invalid-branch/898/1 "2016-12-12T19:28:48Z")

</div>

We would like to make use of an 0.5 feature which fails to parse on 0.4

```julia
@static if Base.VERSION.major == 0 && Base.VERSION.minor < 5 
         sN = sparsevec(sum(N[1:ncategories[i],:], 1)) # Slower, but should be supported by Julia 0.4
     else 
         sN = sum(N[i,:] for i=1:ncategories[i])
 end

```

The problem with the above implementation is that Julia 0.4 still parses both branches, and thus fails. Is there a way to insert something like this such that you get the desired code in each Julia version?

Thank you!

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [December 12, 2016, 7:58pm UTC](https://discourse.julialang.org/t/static-but-do-not-parse-the-invalid-branch/898/2 "2016-12-12T19:58:14Z")

</div>

No.

If this is a part that’s really performance critical (I doubt), you can put it in another function that’s conditionally included and put the 0.4 and 0.5 defs in two different files.
