[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

should es have a recursion depth limit?



infinite recursion in es causes core dumps.  currently, there is
no check to see if you've gone too far down the c stack, which is
used as the es call stack.  i'm proposing adding one.

what i propose is a new, special variable

	%max-call-depth

which will have some default value in the small 100s.  if the depth
of function calls exceeded the number stored in this variable, es
would throw an error.  this should prevent the stack overruns and
make it possible to deal with such infinite recursions in a sane way.
(i.e., in a way that doesn't cause the shell to die.)

the question becomes, what if i really want a very deep set of
calls?  well, you could always set the limit high in your .esrc.
and you may have to also set your ``limit stacksize'' to make it
work.

one thing that makes this worse is that es does not (currently) do
proper tail calling.  therefore, tail recursion -- which should
not have an effect on the call depth -- does.  i regard this as a
serious implementation defect.

if i don't hear any serious disagreements, i'm going to put this in.

paul