Debug.jl icon indicating copy to clipboard operation
Debug.jl copied to clipboard

Improve support for debug traps in global scope

Open toivoh opened this issue 12 years ago • 2 comments

Need to consider the scoping rules in global scope. Should be as simple as suppressing AST transformation in debug_eval for global scopes? Will have to assume that @debug is invoked at global scope. (Possibly check it?)

toivoh avatar Aug 16 '12 08:08 toivoh

https://github.com/toivoh/julia-debugger/commit/ec4d4b3e00b5610cd1c55850e3ad0531ce30fb4c also helped

toivoh avatar Aug 16 '12 11:08 toivoh

It seems that global scoping behavior is a bit more complex than I thought. E g, in global scope

x = 0
let
    x = 1
end
print(x, " ")
let
    x = 0
    let
        x = 1
    end
    print(x)
end

produces 0 1; the first let doesn't assign to the outer x since it's global, while

x = y = 0
for x = 1:4
    y = 4
end
print((x,y), " ")
let  
    x = y = 0
    for x = 1:4
        y = 4
    end
    print((x,y))
end

produces (4,4) (4,4); the first for loop doesn't care that x and y are globals.

toivoh avatar Aug 20 '12 14:08 toivoh