On 06-Jan-2014 Lech Lorens <[email protected]> wrote:
> On 06-Jan-2014 Bram Moolenaar <[email protected]> wrote:
[…]
> > What happens with nested lists and dicts?
>
> Whatever you think would be best. Currently exactly the same that would
> happen locally for string(list_var) or string(dict_var). I find it more
> usable than the current behaviour of sending list items separated by
> newline characters (but it's backwards incompatible, of course).
>
> E.g. I got this with remote_expr():
>
> Remote Vim claims that g:test_list = "[[101, 102, 103, 104], [201, 202, 203,
> 204, [101, 102, 103, 104]], [301, 302, 303, 304, [201, 202, 203, 204, [101,
> 102, 103, 104]]], {'foo': 'bar', 'baz': 'quux', 'dict1': {'foo': 'FOO',
> 'baz': 'BAZ', 'bar': 'BAR', 'dict2': {'list1': [101, 102, 103, 104], 'list2':
> [201, 202, 203, 204, [101, 102, 103, 104]], 'list3': [301, 302, 303, 304,
> [201, 202, 203, 204, [101, 102, 103, 104]]]}}, 'bar': 'baz'}]"
>
> Remote Vim claims that g:test_dict0 = "{'foo': 'bar', 'baz': 'quux', 'dict1':
> {'foo': 'FOO', 'baz': 'BAZ', 'bar': 'BAR', 'dict2': {'list1': [101, 102, 103,
> 104], 'list2': [201, 202, 203, 204, [101, 102, 103, 104]], 'list3': [301,
> 302, 303, 304, [201, 202, 203, 204, [101, 102, 103, 104]]]}}, 'bar': 'baz'}"
I played with the idea a little bit more and while it does have its
pros, it does have major cons.
The pros:
- currently an expression evaluating to a string containing new line
characters is indistinguishable from an expression evaluating to
a list of strings; my proposal fixes the problem,
- dictionaries are handled.
The cons:
- while lists are represented differently in the proposed
implementation, I believe the current implementation makes it
difficult enough to handle lists that this incompatibility might be
a welcome change. But it's still an incompatibility,
- the major incompatibility is the way strings are represented: instead
of getting "foo" you get "'foo'".
The string incompatibility might be handled as a special case. But this
would make the implementation inconsistent.
The wrap-up: I'll stick to using remote_expr("string(expr)") and
recommend this to everyone else needing to handle dictionaries.
--
Lech Lorens
--
--
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.