I'm exploring functional programming with vimL and immediately ran into
seemingly counter-intuitive behavior:

------------------------------------
function! Outer()
        let outer_var = 0
        function! Inner()
                let outer_var += 1
        endfunction
        call Inner()
        echo outer_var
endfunction

call Outer()
-------------------------------------

The result, when I run this from 7.1.156, is that 'Inner' reports
'outer_var' as
unknown.  I was expecting '0' but would eventually like to have my 'Inner'
use 'outer_var' as state via dictionaries or some other mechanism.  It's
disturbing that 'outer_var' is not available to 'Inner'.

Am I missing something?  Is this the intended behavior?  If so, where else
can I read more about scoping?  I've been reading usr_41.txt and eval.txt.

-- 
Ian Tegebo

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui