Nikolay Pavlov wrote:

> 2016-04-20 14:46 GMT+03:00 Bram Moolenaar <b...@moolenaar.net>:
> >
> > Björn Linse wrote:
> >
> >> > The NULL is supposed to be the same as an empty, mutable list.  This is
> >> > tricky, because code that expects a list needs to check for the NULL and
> >> > create the list if needed.
> >>
> >> how could this be possible?
> >>
> >> let x = getreg("a",1,1) " returns NULL
> >> let y = x
> >> call add(x, "text")
> >>
> >> now x is created, but y is still NULL, inconsistent with if x referred
> >> to an non-NULL empty list.
> >
> > OK, yes, in that case it is different from a real empty list.
> > Do we really case about that?
> 
> Do you really want to state in documentation “lists are passed by
> reference, but *some* empty lists are passed by value”? If I got
> mutable empty list from somewhere I expect it to work as mutable empty
> list. E.g. I could use
> 
>     function Extender(lines)
>         call extend(a:lines, systemlist('echo abc'))
>     endfunction
> 
> . Now pass v:_null_list to Extender: what will it do? `a:lines` is a
> new variable, destroyed after function exits.

You have a difficult way of saying it, but I suppose the answer is yes.
Better keep things simple than to avoid an allocation.  We'll have to do
quite a bit of work to make this consistent though.  Also for
dictionaries.

-- 
This is the polymorph virus!  Follow these instructions carefully:
1. Send this message to everybody you know.
2. Format your harddisk.
Thank you for your cooperation in spreading the most powerful virus ever!

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui