Ernie Rael wrote:
> On 3/6/22 5:49 AM, Bram Moolenaar wrote: > > > > Yes, that is the problem we need to tackle. Considering the above, how > > about introducing different null types: > > > > null_string > > null_dict > > null_list > > null_function > > null_partial > > null_channel > > null_job > > > > That will allow for clearing a script-local variable, while keeping the > > type. And it allows for using a null value in a dict or list while > > keeping the type. > > This scheme certainly satisfies my requirements. One question, there's > > if jobs.write != null_job > > but what about > > var sval = '' > if sval == null_string > > is this true or false? Or is string a special case and you need > > if sval is null_string > > Requiring 'is' is confusing In many places an empty string and a null string are considered equal. This is mainly for practical reasons. When do you need to know whether a string is really null or empty? That should be rare. I would think in those cases you likely used "null_string". In the help for that we can add a remark to use "is" to check whether the value really is null. The same is the case for list and dict, empty and null are often considered the same value. For job and channel, which were part of the request to support for clearing a variable, there is no such thing as "empty". Perhaps a job that failed to be created could be equal to null_job? It looks like it does, job_status() returns "fail" then. -- A bad peace is better than a good war. - Yiddish Proverb /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20220306224419.7E2AD1C042A%40moolenaar.net.
