Loading ...
Sorry, an error occurred while loading the content.
 

Re: calling dict function without dict?

Expand Messages
  • Matt Wozniski
    ... Yes, but that s not what you re doing - you re adding a function *with* the dict attribute as a funcref to a dictionary. If you want to call it without a
    Message 1 of 5 , Dec 1, 2008
      On Mon, Dec 1, 2008 at 6:45 PM, Marc Weber wrote:
      >
      > Eg why should this fail?
      >
      > let a = {}
      > function! a.foo() dict
      > echo "foo"
      > endfunction
      >
      > call call(a['foo'],[])
      >
      > I'm not using self anywhere.
      >
      > The help (E725) even states:
      >
      > It is also possible to add a function without the "dict" attribute as a
      > Funcref to a Dictionary, but the "self" variable is not available then.

      Yes, but that's not what you're doing - you're adding a function
      *with* the dict attribute as a funcref to a dictionary. If you want
      to call it without a self... don't make it a 'dict' function, and you
      won't need to provide a "self" dict.

      ~Matt

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Agathoklis D. Hatzimanikas
      ... or, call call(a[ foo ], [], a) Regards, Ag. --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_dev maillist.
      Message 2 of 5 , Dec 2, 2008
        On Mon, Dec 01, at 03:54 Larson, DavidX S wrote:
        > > Eg why should this fail?
        > >
        > > let a = {}
        > > function! a.foo() dict
        > > echo "foo"
        > > endfunction
        > >
        > > call call(a['foo'],[])
        >
        > Try this instead:
        >
        > call a.foo()
        >

        or,

        call call(a['foo'], [], a)

        Regards,
        Ag.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.