On Jun 4, 2013 12:38 AM, "Marc Weber" <[email protected]> wrote:
>
> Excerpts from ZyX ZyX's message of Mon Jun 03 13:28:10 +0200 2013:
> > What for?
> Stupid simple plugins which want to have minimal state such as
> "incermental counter" ?

?! How my proposal is against this? When you create a python function that
uses some variable from the outer scope this scope is saved. This works for
execfile as well.

You don't need globals for such a state at all, you only need persistent
globals if file is supposed to be sourced twice. Thus note about reloading
by resourcing may be valid, note about incremental counter definitely is
not.

> I don't know yet. You're right, you could create a new module and
> import that just to keep state.
>
> Anyway. Current interface is:
>
>   :py
>   :pydo
>   :pyfile
>    pyeval()
>
> They all pollute global state, right?
>
> So do we fix anything by introducing a new sane way for modules only?
>
> What about:
>
> let s:py_scope = 'my_plugin'
>
> and from then one use exec(file/string) to run python code having that
> scope?
>
> s:py_scope could be initailized with the file name.
>
> Then it would be you being able to use the same scope in all plugin/
> autoload/* .vim files and everything would be saner ?
>
> Scripts can be fixed in a backward compatible way, because s:py_scope is
> a NOP in current Vim.
>
> of course we could introduce a new set of commands/functions, too.
>
> Being 100% backward compatible would require duplicating all
> commands/functions/..
>
> Marc Weber
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups
"vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui