>
>> I've been wondering what, if any kinds of checks or warnings Julia gives
>> at compile time, or if there are any packages that can type check and give
>> you warnings on your code.
>>
>>
Dear Julia developers,
first of all let me thank you for all your hard work. I have started to use
Julia recently to develop image processing algorithms and I have been very
pleasantly surprised by the achievable performance of Julia code (although
it makes the code less elegant), easy parallelisation, relatively low
penalty for genericity and the breadth of available libraries.
However, let me vote strongly in favor if incorporating more compile-time
checks. This is my biggest issue with Julia. Too many errors are discovered
only when the code is run, which makes the development cycle slow,
especially if the code takes non-trivial time to execute. I admit I am
sloppy and I make stupid errors. But languages like Ocaml, C or Java will
let me know when compiling, usually in less than a second. [Ocaml used to
be my favorite language for a long time and if it allowed a little more
flexibility, had a little better performance and supported multicore, I
would continue using it. There, when something compiled, it almost always
also ran and gave results, surprisingly often good results.] With Julia
(and Matlab and Python), I need to actually run the code to find out.
Although I obviously try to test my code on small examples first, it is
still annoying to see most of the code run fine, only to find a typo in the
last few (recently added) lines. This decreases my productivity.
It seems that most of the errors could be easily detected by compile-time
static analysis. For example, Julia will happily compile the following:
function test()
unknown_function()
end
function test2()
println(unknown_variable)
end
Lint.lintfile catches the second error but not the first,
TypeCheck.check_method_calls will not find either. I think I understand the
reason - Julia expects that perhaps some other code will define
"unknown_function" and "unknown_variable" before test() or test2() are run.
I understand there might be case for that kind of "dynamic" code but it
seems to be a rather unusual (and dangerous) pattern. Could not there be a
compiler switch that would say
a) my functions do not use any global variables except when explicitly
marked; and
b) my functions are not calling any function created on-the-fly, except
when explicitly marked; or
c) my functions do not use anything not known at this point except when
explicitly marked (forward references)
Or perhaps the compiler could output a warning (not an error), with a
possibility to switch it off, if the programmer knows what he/she is doing.
The third kind of common errors I am getting is "no method xxx" when I get
the types wrong, as in
function test3()
println(3^[3;2])
end
I would love the compiler to let me know (as in Ocaml or Haskell). I
understand that this conflicts with some design choices (such as functions
not having a fixed return type) but in test3(), everything is static and
known, so the compiler should be able to tell me.
If the compiler could report these problems, it would be in my opinion a
big step towards increasing the productivity of Julia programmers.
Keep up the good work. Yours,
Jan