Static.jl vs StaticNumbers.jl

StaticNumbers.jl is a lot older than Static.jl, and at the time, there was not so much discussion about invalidations affecting load time. Also, constant propagation in Julia was not nearly as good as it is now. I think it is really cool that something like StaticNumbers.jl is possible to do in Julia, but that’s mostly theoretical, and In practice I tend to use Val instead in my own code in the rare cases where constant propagation is not enough.

What I really would wish for in the core language is a feature that lets you branch on whether a value is known at compile time, without having to use a Static or Val type at all.

4 Likes