JuliaLang/julia — Issue #334: use indentation to give better error messages?
Author: StefanKarpinski
Created: 2012-01-11 20:39:34+00:00
State: open
Labels: enhancements, speculative

This is sort of an interesting idea that gets some of the benefit of significant indentation without going so far as actually making it significant. I has this code in a file:

```
let buf = Array(Uint8, 17) # maximum decimal digits for Float64
function grisu(x::Float64, mode::Integer, digits::Integer)
sign, len, pt = grisu(x, mode, digits, buf)
sign, ASCIIString(buf[1:len[1]]), pt
end
```

And got the the following error message when I loaded it:

```
Syntax error: incomplete: let at j/grisu.j:18 requires end at j/grisu.j:23
```

If the compiler looked at the indentation, it could potentially figure out that the `end` token that's there was probably meant to be associated with the `let` and it's the `function` that's missing an `end`. This is a pretty simple example, but there are cases where this could make error messages much clearer. This is no priority, obviously, but I thought it was an interesting usability idea.