Nikolai Weibull wrote:
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.
>
> nikolai
As 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.
Why?
Vim is a good programming language, arguments as such should never be mutable.
When a value can be passed back (in languages which allow it), the argument is
not the value but the _address_ of the value, and that is, again, not changeable.
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
Best regards,
Tony.
--
What this world needs is a good five-dollar plasma weapon.