On 3/8/22 11:44 AM, Bram Moolenaar wrote:
On 3/8/22 5:20 AM, Bram Moolenaar wrote:
Patch 8.2.4526
Problem:    Vim9: cannot set variables to a null value.
Solution:   Add null_list, null_job, etc.
How about an "is_null(t: any): bool" method, (or "isnull()")? I could
roll my own, but the "if else if else ..." seems expensive. (unless it
gets optimized internally into a switch-case :-) )
What is it you want to do?  We recently added support for comparing with
"null".  That will match all the null_* values.  Thus allo of these are
true:
        null == null_string
        null == null_blob
        null == null_list
        null == null_function
        null == null_job

In the previous discussion I had thought that givenĀ  var t:string,
it was necessary to do "if t is null_string" to test if it is
really null. I'm looking for a way to test for really null uniformly
no matter the type, and without noting if I need to use "is".

I'll build a new vim today and run some experiments, which I should
have done before posting the message.

-ernie

Still need to add some more tests.  It worked with the functions before,
so it should work with the value as well.


--
--
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/7892cf16-45c8-1dab-845f-0df5189f35d2%40raelity.com.

Raspunde prin e-mail lui