In vim script (vim 8.x and older), a variable can belong to one of a number of scopes. While it's true it's idiosyncratic as no other language has this feature, it's also consistent as no other language has e.g., "buffer variables."
buffer-variable b: Local to the current buffer.
window-variable w: Local to the current window.
tabpage-variable t: Local to the current tab page.
global-variable g: Global.
local-variable l: Local to a function.
script-variable s: Local to a :source'ed Vim script.
function-argument a: Function argument (only inside a function).
vim-variable v: Global, predefined by Vim.
For the most part, you can think of a:
as merely a marker for "argument" as they are special (and otherwise ambiguous) in the language's grammar. For instance,
string[a:var] " index by argument
string[a : var] " slice
However, each of these scopes are also exposed as a dictionary so a:['arg']
and a:.arg
are also technically valid (but not recommended).
vim9 script introduces def
functions, where the prefix is removed. Arguments then behave similarly to python accessible by name alone.
def MyFunc(...itemlist: list<number>)
for item in itemlist