guile-user
[Top][All Lists]
Advanced

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

Re: Stack Size?


From: Lynn Winebarger
Subject: Re: Stack Size?
Date: Sun, 1 Sep 2002 14:08:35 -0500

On Sunday 01 September 2002 12:13, Rob Browning wrote:
> Mikael Djurfeldt <address@hidden> writes:
> 
> > Guile is supposed to be "nice" towards novice users.  Infinite
> > recursions is a very common error.  Without a stack check, the
> > effect is that the machine freezes due to excessive swapping,
> > preventing the novice user from even examining what has happened.

       There should be a smarter way to choose this kind of stack
enforcement, that could be implemented if guile moves towards
faster continuations (i.e. requiring more analysis than the parser
does now) and stops using a single stack.  I'm not sure exactly
what I'm talking about, but I have a vague idea that this
is probably done in most optimizing scheme interpreters/compilers.
I think Dybvig's dissertation is on this very topic.
     Then a single stack could be used for certain simple types
of recursions that would catch the novice cases and, while
still being annoying for someone who knows what they're doing
when they write a simple,deep recursion, might avoid some
of the most egregious trespasses against the non-novice.

> I tend to think that if we're going to enforce a stack limit, it
> should be fairly high by default.  Otherwise if you write a module
> that you know will be likely to use very large stacks for normal
> inputs, you've got to either communicate the need to raise the stack
> limit to everyone using your module via documentation, or you've got
> to raise the limit with a debug-set! call inside the module, and the
> latter solution is unworkable when you have two modules that have
> different ideas of how high the stack limit needs to be, since the
> result becomes dependent on load order.

       It's a bad idea for a default.  Most novices are not novices 
forever, yet compiling this option in seems to optimize for that case.  If
this is aimed at the application scripting user, the application
can have a button for novice/expert mode.  If it's for just
plain old general purpose REPL usage, everybody's entitled
to experience at least one accidental infinite recursion.

> (A part of me wonders whether or not we're just infringing on ulimit's
>  territory here...)
    The answer is yes.  Actually, the answer is plain old scheme mode
should never run out of stack because it is not C.  Application writers
should be able to tweak that behaviour, perhaps, or maybe they should
just be able to set a bound on how much system memory the gc is
allowed to allocate.  You know, register a hook for when that happens
so they can ask the user whether to proceed or whatever.  There would
probably be some standard system exception this could throw if the
user wanted to give up so the system wouldn't have to abort.

Lynn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]