Thinca wrote:

> 2016-03-17 18:45 GMT+09:00 Bram Moolenaar <[email protected]>:
> >
> > Lilydjwg wrote:
> >
> >> On Wed, Mar 16, 2016 at 03:43:06PM +0100, 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?
> >>
> >> I get these:
> >>
> >> 处理 function <SNR>30_import[11]..<SNR>30__import[20]..<SNR>30__build_module 
> >> 时发生错误:
> >> 第   14 行:
> >> E924: can't have both a "self" dict and a partial: <SNR>30_load
> >> Mark: Invalid value type for g:mwPalettes[maximum]
> >>
> >> At least two plugins are broken.
> >>
> >> One of them is the mark.vim plugin, which does this:
> >>
> >> elseif type(g:mwPalettes[g:mwDefaultHighlightingPalette]) == 
> >> type(function('tr'))
> >>
> >> The left side evaluates to a function ref. The result is 10, not 2.
> >>
> >> The other is from an old version of neocomplete, 
> >> autoload/vital/_b6a796b.vim. You can view it here:
> >> https://github.com/lilydjwg/dotvim/blob/master/autoload/vital/_b6a796b.vim#L144
> >>
> >> There are a lot of similar error messages from neocomplete too (both the
> >> version I'm using and the latest version on GitHub).
> >
> > Please try the latest patch, hopefully this is fixed now.
> 
> This is not fixed in Vim 7.4.1603.
> 
> I think funcref and partial are same thing in Vim script, so
> type({partial}) should return 2.
> 
> diff --git a/src/eval.c b/src/eval.c
> index a2288f9..69969fe 100644
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -20398,6 +20398,7 @@ f_type(typval_T *argvars, typval_T *rettv)
>      {
>         case VAR_NUMBER: n = 0; break;
>         case VAR_STRING: n = 1; break;
> +       case VAR_PARTIAL:
>         case VAR_FUNC:   n = 2; break;
>         case VAR_LIST:   n = 3; break;
>         case VAR_DICT:   n = 4; break;
> @@ -20411,7 +20412,6 @@ f_type(typval_T *argvars, typval_T *rettv)
>              break;
>         case VAR_JOB:     n = 8; break;
>         case VAR_CHANNEL: n = 9; break;
> -       case VAR_PARTIAL: n = 10; break;
>         case VAR_UNKNOWN:
>              EMSG2(_(e_intern2), "f_type(UNKNOWN)");
>              n = -1;
> 
> 
> Or, a funcref in a dictionary must not be converted to a partial for
> compatibility.

That is actually very useful.  E.g. to pass a callback to a function and
have it automatically bind the dictionary.

So let's make type() ignore the difference between a plain Funcref and a
partial.  Perhaps it would be useful to have some way to get information
about the partial, that can be added later.

-- 
>From "know your smileys":
 :----}  You lie like Pinocchio

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