Kent Sibilev wrote:

> On Wednesday, March 16, 2016 at 10:43:13 AM UTC-4, Bram Moolenaar wrote:
> > Kent Sibilev wrote:
> > 
> > > On Tuesday, March 15, 2016 at 2:33:55 PM UTC-4, Bram Moolenaar wrote:
> > > > Patch 7.4.1577
> > > > Problem:    Cannot pass "dict.Myfunc" around as a partial.
> > > > Solution:   Create a partial when expected.
> > > > Files:      src/eval.c, src/testdir/test_partial.vim
> > > > 
> > > 
> > > This change doesn't allow functions like this:
> > > 
> > > function! s:cache_clear(...) dict
> > > 
> > > function! rails#cache_clear(...)
> > > 
> > > to be defined at the same time. Any particular reason for this, cause
> > > this change breaks vim-rails plugin.
> > 
> > The patch should not change anything about what functions you can
> > define.
> > 
> > What is the error?  Can you make a small example that fails?
> 
> Here is the small script to reproduce:
> 
> function s:cache_clear(...) dict
>     return self.name
> endfunction
> 
> function! s:function(name)
>     return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), 
> '<SNR>\d\+_'),''))
> endfunction
> 
> let s:obj = {'name': 'cache'}
> 
> let s:obj['clear'] = s:function('s:cache_clear')
> 
> " this works
> echo s:obj.clear()
> 
> " this fails with E924
> echo call(s:obj.clear, [], s:obj)

Thanks.  Apparently we didn't have a test for using function() this way.

That s:function() call is not needed to reproduce the problem.

Fix should be simple.

-- 
"I simultaneously try to keep my head in the clouds and my feet on the
ground.  Sometimes it's a stretch, though."              -- Larry Wall

 /// 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