On 4/10/06, Bertram Scharpf <[EMAIL PROTECTED]> wrote:
> I read vim tip #1198 and I'm amazed the recursion doesn't
> lead to a stack overflow. I tried to force one and waited
> for estimately 150M executions:
>
>   map <silent><F6> :if strlen(getline("."))<78\|exec "norm 
> Ax\e"\|else\|pu_\|endif\|redraw<cr><F6>
>
> Can I rely on this and if yes, why?

Bertram,

    :help recursive_mapping
and
    :help 'maxmapdepth'
explains some of it.

The  :help 'maxmapdepth' explains why 'maxmapdepth' does not apply
to "tail recursion" case.

I think that with "tail recursion" recursive mappings,
vim memory does not grow (confirmed by your experiment.)

I think C recursion or stack grows is *not* involved in processing of
recursive mappings, I think the code manipulates the input queue.
This is my guess though.

You can read more about general notion of "tail recursion" at
    http://en.wikipedia.org/wiki/Tail_call

Yakov

Reply via email to