Nikolay Pavlov wrote:

> On Apr 25, 2014 6:22 PM, "Bram Moolenaar" <[email protected]> wrote:
> >
> > Alex Efros wrote:
> >
> > > On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
> > > > > My guess right solution should be
> > > > >     fun s:Foo()
> > > > >     endfun
> > > > >     let g:Foo = function('s:Foo')
> > > > > but I'm not 100% sure.
> > > >
> > > > That should be the right way.  The more things are script-local the
> > > > better.  But check that it actually works.
> > >
> > > One thing will break in my code because of this change: exists('*Foo') now
> > > return false. Is this correct behaviour in case g:Foo contains Funcref?
> >
> > Previously it was finding the global Foo() function.  Now it is
> > script-local, and the global Foo variable is not a function but a
> > Funcref variable.
> 
> Using exists('*') for testing funcrefs is a better replacement for type()
> comparison in a number of cases because the fact that you received a
> funcref never means you can call it, but using exists('*') does. It is very
> bad idea to break this.

Not sure what you are saying here, exists('*var') never worked for when
var is a Funcref.  You can do it this way: exists('*' . string(var)).


-- 
>From "know your smileys":
 :-X    My lips are sealed

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