Nikolai Weibull wrote:

> On 9/16/07, Nikolai Weibull <[EMAIL PROTECTED]> wrote:
> 
> > function bug#reproduce()
> >   echo bug#number
> > endfunction
> >
> > let bug#number = 1
> >
> > :call bug#reproduce()
> >
> > which will give you the following output (instead of 1):
> >
> > Error detected while processing function bug#new:
> > line    1:
> > E121: Undefined variable: bug#number
> > E15: Invalid expression: bug#number
> > 0
> > Press ENTER or type command to continue
> >
> > Accessing the variable works fine, however:
> >
> > :echo bug#number
> > 1
> >
> > So what's going on?
> 
> Argh.  Inside the function, you'll have to use the g: prefix.  Outside
> it works fine.  Bram, could the lookup routines please be fixed to
> deal with this automatically?  I realize that the whole g:, l:, b:,
> ... business makes "sense" for normal variable names, but when
> referencing autoload variables, isn't the autload-namespacing stuff
> enough?

I don't see a good reason to make an exception.  Requiring the use of g:
or s: makes it consistent.  Otherwise there would be a list of
situations when you don't need to add g: before a variable name.

-- 
CONCORDE:  Quickly, sir, come this way!
LAUNCELOT: No!  It's not right for my idiom.  I must escape more  ... more ...
CONCORDE:  Dramatically, sir?
LAUNCELOT: Dramatically.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui