😤 Multi-line expressions aren't fully computed

Since this is valid syntax, any detection mechanism that tries to check for (and warn about) this kind of thing would have to be heuristics based - like checking for lines beginning with a + or -, maybe checking the indentation, etc. Any such check would be prone to have a lot of false positives and negatives, so the Julia compiler wouldn’t be the right place for it. It would be way too annoying to have the ocmpiler warn about such code in an hard-to-predict (because of the heuristics) way when the code is valid.

That said,

it would be nice to have it in some way as part of the extension. A warning for this was proposed as a github issue and rejected several years ago because it’s valid Julia syntax, but the Rust developer experience is so good precisely because tools like clippy warn about code even when it’s technically correct, if it’s a pattern that a lot of people make mistakes with. So if you can think of some good heuristics to detect this kind of code, it might be worth bringing it up in the Slack vscode channel.

(Speaking of tools, do you use anything like the JuliaFormatter or Runic.jl ? I would think those would reformat this so the latter lines of the expression don’t have an indent, hinting at the issue even if they don’t directly explain it. )

4 Likes