On Thu, 19 Nov 2009 15:15:14 +0900, pansz <[email protected]> wrote:
> plugin/framework.vim
> engine_a.vim
> engine_b.vim
> engine_c.vim
>
...
>
> This architecture requires the framework give the access right of some
> variables and functions to the engine. If we define g: variables it will
> be global, I want the engine to be the "friend" of the framework, i.e.
> the particular script engine.vim can access all script-local stuffs of
> framework.vim, is that possible?

It's possible as I replied before.  But IMHO, you should not do so
unless you REALLY need it, for example, testing script-local stuffs.

There is another way which is to provide API of framework.vim to
interact with engine_x.vim.  For example:

autoload/framework.vim:
  function! framework#get_parameter_x()
    return s:parameter_x
  endfunction

  function! framework#set_parameter_x(value)
    let s:parameter_x = a:value
  endfunction

  function! framework#_call_internal_stuff()
    return s:zap()
  endfunction

  function! s:zap()
    return '...'
  endfunction

plugin/engine_x.vim:
  call framework#set_parameter_x('...')
  call framework#_call_internal_stuff()

Did you consider about this way?  If so, why do you reject it?


-- 
To Vim, or not to Vim.
http://whileimautomaton.net/


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

Reply via email to