In line evaluation failing for valid (if odd) syntax in while statement


#1

Trying to evaluate the following (meaningless, but I have tried to make it minimal) function

function checkIt()
    state = []
    while(true)
        break
    end
    return state
end

One gets an “complete: “function” at … test.jl” error.

The problem is the “while(true)”, it needs to be written as “while (true)”, or better I suppose “while true”.
[Space after the while]

However I believe “while(true)” is still valid syntax, it is certainly accepted by the repl.


#2

Works fine for me both in the REPL and loading from a file (didn’t try Juno). How are you trying this?


#3

The problem only appears to be in Juno, editor pane. So with the file open, on the function shift-enter for inline evaluation.


#4

Apologies if this is a double post, my previous reply hasn’t yet appeared.

I think the problem only appears in Juno, using the ‘in-line’ evaluation. So in this test instance I have a file with the above function in it. I hit ‘shift-enter’ with the cursor on the function to ‘evaluate’ it and the error is thrown.

It’s hardly earth-shattering - I just thought I should mention it.


#5

Definitely worth mentioning. Maybe also filing as an issue on the Juno repo?


#6

Will do, thanks.


#7

Cross-ref:

Imho we shouldn’t allow this at all, but if someone feels strongly about this please comment at