Monday, December 16, 2013

Re: retrieve variable name

On Mon, Dec 16, 2013 at 12:38:34AM +0400, Nikolay Pavlov wrote:
> Dictionaries are passed by reference. So dictionaries in s:data_n and
> s:candidates... are exactly the same dictionaries and you can just use
>
> function candidate.function_a()
>
> and it will be accesible as both s:candidates[n].function_a and
> s:data_n.function_a.

Ah, he he… great ! Embarrassing for me but great ! :)

> There is no need in generating multiple functions with exactly the same
> body though:

That is very true. But ->

> function is not bound to the dictionary thus you can simply
> generate it once and assign obtained funcref.

No sure what (or how) you mean here. You mean something like the
following ?

<--
function! Mfun() dict
echo self.a_key
endfunction

let Mref = function('Mfun')

let mdict = { 'a_key': "Hello", 'fun': Mref }
-->

Thanks again for your help and best regards,

--
 ___________________
| $ post_tenebras ↲ |       waouh !
| GNU        \ /    |      /
|          -- * --  |     o
| $ who ↲    / \    |_-- ~_|
| Alexandre Hoïde   |  _/| |
 -------------------

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: