novelistparty
novelistparty

Reputation: 404

Can Julia (julia-lang) code be statically analyzed to avoid run-time type errors?

I recently ported one of my simulations to Julia and I discovered several type errors only at run-time. I wish to statically analyze my Julia code. MATLAB has a similar problem in only finding many errors at run-time.

The only tool I found (TypeCheck.jl) performs a small subset of the static analysis that I would expect from a compiler.

Is there a static analyzer for Julia scripts so I can avoid many of what are now run-time errors?

Is there something that I could use with the LLVM JIT compiler? (I don't know much about how the Julia compiling works and what is and isn't possible)

Is this even possible due to the nature of Julia?

Upvotes: 15

Views: 1178

Answers (1)

John Myles White
John Myles White

Reputation: 2929

I think the answer depends on which kind of run-time error you want, since Julia's compile-time occurs at a point in time that most compiled languages would call run-time.

If you type the inputs of all of your functions and also type all of the variables in all of your functions, you'll be able to get a lot of type errors at Julia's compile-time.

Upvotes: 4

Related Questions