sent 02:13:27 22 October 2010, Friday
by Bee:
> function! RndTest01a(test,bins,times)
>
> call Time(RndTest01a(1, 10, 5000))
>
> The function "RndTest01a" in my Timer(fu) returns values as expected
> but only seems to time the execute a:fu. The "RndTest01a" values and
> the echo time are not displayed until the test is done, about 11
> seconds but shows 0.000138 seconds with the wrapper.
In vimscript all arguments are computed before running a function, so you tried
to execute the result of `RndTest01a', not the `RndTest01a' itself. Your second
version (which passes a string `:call ...') has no such error (though `:' is not
required here). My version have the following advantage: it is much simpler to
pass long or even recursive complex data to called function.
> call Time(RndTest01a(1, 10, 5000))
<...>
> I tried your suggestion "Time(funcref, ...)" with several variations,
> but got errors each time, and still only timed the call call...
> (~0.000140 seconds).
In this case you should have used ``Time('RndTest01a', 1, 10, 5000)''.
No comments:
Post a Comment