Maybe we can start by reading that post and looking at examples of Julia’s errors and considering how they could be more beginner-friendly.
xs = [1,2,3]
xs[0]
% julia tmp.jl
ERROR: LoadError: BoundsError: attempt to access 3-element Vector{Int64} at index [0]
Stacktrace:
[1] getindex(A::Vector{Int64}, i1::Int64)
@ Base ./array.jl:861
[2] top-level scope
@ /tmp/tmp.uyTu9zl540/tmp.jl:2
in expression starting at /tmp/tmp.uyTu9zl540/tmp.jl:2
Rewriting the error:
1 | xs = [1,2,3]
2 | xs[0]
^^^^^
I tried to access a Vector{Int64} at index [0] but the valid indexes are
[1], [2], [3].
The stack of function calls, from latest to earliest, was:
[1] getindex(A::Vector{Int64}, i1::Int64)
@ Base ./array.jl:861
[2] top-level scope
@ /tmp/tmp.uyTu9zl540/tmp.jl:2
- arrows point at the location in the code, with context. Does julia currently have the ability to isolate code spans so that the
^^^^
arrows can work? - the valid indexes are mentioned
- uses full sentences
- uses “I” for the compiler, which does have a more relatable tone IMHO
- doesn’t introduce “stacktrace” jargon