On Thursday, December 11, 2014 08:10:38 PM Petr Krysl wrote: > The moral of this story is: If you can't or won't declare every single > variable, don't do loops. They are likely to be a losing proposition.
Just to follow up further, this is not at all the right moral to absorb from this. A better set of morals is: - use code_typed or TypeCheck or Lint to diagnose problems - remember that julia optimizes functions as a unit. Therefore, in a loop with a type issue, one "brute force" solution is to create a separate function just for running that loop. The types will be known when that function gets compiled (even if you don't annotate anything with their types), and so your type problem should evaporate. --Tim
