Juno, modules and keyword `end`

I much appreciate workflow made available by Juno while developing a module (see atom-julia-client/workflow.md at master · JunoLab/atom-julia-client · GitHub). But I encountered this silly situation:

module abc
function f(a::Vector{Int})
  s = 0
  for x in a[2:end]
    s += x*x

When the cursor is on the end of function f, I see Main on the status bar, no more Main/abc. And if I add a new function alpha at the end of my module, and evaluate its definition as usual, I can’t use it:

abc.alpha(3)  UndefVarError: alpha not defined

I was very perturbed (because I use daily module’s development with Juno), until I realized that end in a[2:end] was misinterpreted by Juno, and ruined following scopes – of course my module was a little larger, and I needed some time to discover this bug, sigh.

Can you try Pkg.status() and find out what version of CodeTools you are on? This should be fixed, but I’m not sure if we released the fix yet.

 - CodeTools                     0.4.3

If you are aware of the problem, it’s ok, I’m not in a hurry :slight_smile: There is another related situation, where a macro, e.g. @inbounds, precedes a for loop, and so on.

Many thanks for your beautiful work !

1 Like