Adding a null list to a list causes problems with echo

10 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Apr 22, 2020, 11:15:00 AM4/22/20
to vim_dev
Hi,

When a null list (test_null_list()) is added to a list, then echoing the
list doesn't produce any output:

  :let l = [1, 2, test_null_list()]
  :echo l
  :echo string(l)

But echoing the first two list elements works:

  :echo l[:1]
  [1, 2]

- Yegappan

Bram Moolenaar

unread,
Apr 22, 2020, 1:15:01 PM4/22/20
to vim...@googlegroups.com, Yegappan Lakshmanan
Another case where a NULL list isn't handled like an empty list.
I'll fix it.

--
If someone questions your market projections, simply point out that your
target market is "People who are nuts" and "People who will buy any damn
thing". Nobody is going to tell you there aren't enough of those people
to go around.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Yegappan Lakshmanan

unread,
Apr 22, 2020, 1:51:33 PM4/22/20
to Bram Moolenaar, vim_dev
Hi Bram,

On Wed, Apr 22, 2020 at 10:14 AM Bram Moolenaar <Br...@moolenaar.net> wrote:

Yegappan wrote:

> When a null list (test_null_list()) is added to a list, then echoing the
> list doesn't produce any output:
>
>   :let l = [1, 2, test_null_list()]
>   :echo l
>   :echo string(l)
>
> But echoing the first two list elements works:
>
>   :echo l[:1]
>   [1, 2]

Another case where a NULL list isn't handled like an empty list.
I'll fix it.


Thanks for the fix. That works. A similar problem exists for the null Dict.
After making the change for a null Dict, I see that comparing a null
Dict against an empty Dict returns False.

  :echo {} == test_null_dict()
  0
  :echo [] == test_null_list()
  1
  :echo "" == test_null_string()
  1
  :echo 0z == test_null_blob()
  1

- Yegappan

Reply all
Reply to author
Forward
0 new messages