Infinite recursion and StackOverflowError in Julia
In order to evoke StackOverflowError in Julia it's enough to write a function, which result in infinite recursion. Let's see, how it works:
julia>
function foo(arg)
if arg>1
println("x")
else
foo(arg)
end
end
And now let's call foo() function with an argument:
julia> foo(1)
Result is predictable:
ERROR: StackOverflowError:
Stacktrace:
[1] foo(::Int64) at ./REPL[7]:5 (repeats 80000 times)
As you on the result of running a script, Julia is still trying to execute our infinite recursion 80.000 times. Such a persevering attempt! :)