Ken Takata wrote:

> 2016/8/1 Mon 22:41:35 UTC+9 Bram Moolenaar wrote:
> > Patch 7.4.2137
> > Problem:    Using function() with a name will find another function when it 
> > is
> >             redefined.
> > Solution:   Add funcref().  Refer to lambda using a partial.  Fix several
> >             reference counting issues.
> > Files:      src/vim.h, src/structs.h, src/userfunc.c, src/eval.c,
> >             src/evalfunc.c, src/channel.c, src/proto/eval.pro,
> >             src/proto/userfunc.pro, src/if_mzsch.c, src/regexp.c, 
> > src/misc2.c,
> >             src/if_py_both.h, src/testdir/test_lambda.vim,
> >             src/testdir/test_expr.vim, runtime/doc/eval.txt
> 
> Thank you for fixing many problems with closure.

Turns out it was quite complicated.  Some parts seemed uneccessary, but
without it an illegal memory access occurs when the garbage collector
kicks in.

> BTW, I think it's better to use funcref() instead of function() in the
> example of [closure] argument:
> 
> --- a/runtime/doc/eval.txt
> +++ b/runtime/doc/eval.txt
> @@ -8296,7 +8296,7 @@ See |:verbose-cmd| for more information.
>                               :    let x += 1
>                               :    return x
>                               :  endfunction
> -                             :  return function('Bar')
> +                             :  return funcref('Bar')
>                               :endfunction
>  
>                               :let F = Foo()

Good idea.  There might be more.

-- 
People who want to share their religious views with you
almost never want you to share yours with them.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui