> Like 'var udp: list<string>', it would be nice to declare the global
> equivalent 'g:udp: list<any>' (redundant, but reminds me what Vim is
> expecting when I look at the code).
The problem is that the type can't be enforced. In legacy script it has
always been possible to assign anything to a global variable. Also it
can be deleted with :unlet and given a completely different value.
In most cases you can use a script-local variable. In Vim9 script you
can give these a type and that will be enforced. This works best,
because references to the variable will be in the same script, the
knowledge of what the variable is for and what it's type is is
localized.
Theoretically it would be possible to add a new type of global variable
that works differently. I do not see enough need for this, while it
does add complexity. And especially that when using g:someVar you don't
know where it was defined and what kind of variable it is.
--
hundred-and-one symptoms of being an internet addict:
56. You leave the modem speaker on after connecting because you think it
sounds like the ocean wind...the perfect soundtrack for "surfing the net".