Johnny Blaze wrote:
> On Sat, 15 Jan 2005 19:20:18 +0100, Bram Moolenaar <Bram@...> wrote:
>>Funcref variables can be used like a function name in an expression.
>>They cannot be used with ":call", because it takes the name literally.
>>That could be changed though. It would involve using the ":call"
>>argument as an expression.
> I think that would be helpful. In my current project, I have a group
> of functions that are called from a menu. At the end of each one of
> them, I want a function to run to check the state of things (like if
> the menu needs to be regenerated, the data file read or writtten,
> etc). So instead of
> menu -bar Test.One call s:one()|call s:checkState()
> menu -bar Test.Two call s:two()|call s:checkState()
> I want
> menu -bar Test.One call s:action("s:one")
> where s:action creates a funcref, executes it then the checkState function.
> The point is, not all funcrefs may be used as actual functions and
> return a value. They may be used in a subroutine manner and just need
> to be called.
In the meantime, instead of
you can use
let unused = a:action()
which has the same result.
(If ":return <value>" is not used in a function, it returns the number