On 4/24/07, Andy Wokula <[EMAIL PROTECTED]> wrote:
Nikolai Weibull schrieb: > On 4/24/07, Andy Wokula <[EMAIL PROTECTED]> wrote: >> Thomas schrieb: > >> > So maybe one could make vimscript search a variable foo as l:foo, >> a:foo, >> > (maybe also: w:foo, b:foo), s:foo, g:foo, and then throw an undefined >> > variable name error if none exists. Or so. > >> Don't like the idea. >> In Vim script there is no need or possibility to declare variables. >> Now, if I forget to init a fun-local variable (happens often to me) >> Vim gives me a helpful error ("undefined variable"). > > And I have the same problem with a: prefixes for my arguments. Fine, > keep prefixes for g:, w:, and b:, but a: is just such an incredibly > nonstandard way of doing things. In almost all languages parameters > are treated the same as local variables. > > nikolaiAs long as function arguments are read-only, it is good to have the a: modifier. In fact, why are they read-only, although call is by value?
Yes, that's the reason for the a: modifier. And yes, why are they read-only? VimScript isn't a functionaly programming language. Variables are mutable; arguments should be to. Although I'm sure there's an implementation reason for this, it must be possible to fix. Still, I don't have a patch, so I should probably just shut up now. I just hoped it could be better to spend some time to remove this restriction and drop the requirement of a: instead of adding additional handling for the declaration of parameters. nikolai
