Peter Odding wrote the following on 12.11.2011 16:25
Hello Peter,
>> It would also be nice if the script would either 'unlet' the variables
>> again, or
>> limit their scope ':h internal-variables'. See attached patch as example.
>
> I thought variables inside functions were implicitly in function scope
> (i.e. you don't need to specify the "l:" prefix) and you don't need to
> :unlet them because this will happen implicitly when the function
> returns. Did I misunderstand? Oh my then I have a lot of code to fix :-)
>
> - Peter
Thanks for the hint. I looked again into documentation and it seems you are
right.
,----[ :h local-variable ]--------
*local-variable* *l:var*
Inside functions local variables are accessed without prepending anything.
But you can also prepend "l:" if you like. However, without prepending "l:"
you may run into reserved variable names. For example "count". By itself it
refers to "v:count". Using "l:count" you can have a local variable with the
same name.
`---------------------------------------------
Still i think being explicit instead of implicit is a good habit for writing
near any code and also the documentation mentions that you have to be careful
about variable naming schemes without the 'l:' . Especially when it comes down
to official runtime files.
My personal hope and intention is to help to make runtime files the same code
quality as vim itself.
--
Regards,
Thilo
4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php