You can already do quite a lot if you define your own assert function or
command for this.
Ok, I now uploaded a plugin[1] that does this. Maybe somebody finds this
useful too.
The handling of script local functions is suboptimal though, which is
why I still think this should be integrated
Sanoblast wrote:
Looking back, now that Vim script has become much more complex, a bit
more type checking would be good.
A valid point. Mabye this could be done by an assert command/function
that checks its arguments or does nothing depending on an option (maybe
Thomas wrote:
As mentioned in the documentation, automatic conversion only happens
between numbers and strings, not with Lists and Dictionaries. This is
to avoid mistakes, e.g., trying to concatenate a List and a String.
Something like
let l = [1,2,3]
exec Foo . l
could
Looking back, now that Vim script has become much more complex, a bit
more type checking would be good.
A valid point. Mabye this could be done by an assert command/function
that checks its arguments or does nothing depending on an option (maybe
'debug')/flag/variable?
Problem
As mentioned in the documentation, automatic conversion only happens
between numbers and strings, not with Lists and Dictionaries. This is
to avoid mistakes, e.g., trying to concatenate a List and a String.
Something like
let l = [1,2,3]
exec Foo . l
could come handy though -- which
Something like
let l = [1,2,3]
exec Foo . l
could come in handy though -- which isn't possible now.
Although I just realized that lists seem to be passed on by reference
and this would create a new copy if the string presentation of a list
were a parseable list.
Which leads to another
let l = [1,2,3]
exec Foo . l
Which leads to another point: How do I pass a list by reference to Foo
Sorry, I somehow seem to have forgot what the original problem was --
which I should able to solve with the function() call() functions.