Hi and thanks to all of you for your help.
On Sun, Dec 15, 2013 at 09:12:21PM +0400, Nikolay Pavlov wrote:
> Not possible.
>
> This looks like XY problem. What for do you need such thing?
I probably don't. I am not a dev and a noob at Vim scripting, so I try
things.
Here, I was trying to do something like this :
define some data -->
let s:data_1 = {
\ 'a_key': 'some_data'
\, 'another_key': 'data...'
...
\}
let s:data_2 = {
\ 'a_key': 'some_other_data'
"similar (but not necessarily strictly identical) structure as data_1...
\}
.
.
let s:data_n...
<--
And later, put those sharing common treatments in lists. The following
example is why I was trying to retrieve the variable ?name? :
-->
let s:candidates_for_anonymous_function_a = [ s:data_x, s:data_y, ... ]
for candidate in s:candidates_for_anonymous_function_a
function {?name?(candidate)}.function_a()
return some_fancy_function(self.a_key)
endfunction
endfor
<--
Which would allow me to later use 's:data_n.function_a()'.
I thought that would be fun as a composing tool, rather flexible and,
more importantly, complying with my way of thinking.
I could still do it if I store my variables in lists as strings, and
later use 'eval()' on them, as suggested by Tony.
But perhaps this is just my inexperience which leads me to weird
constructions. ^^
Thanks again 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.
Sunday, December 15, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment