According to FlexSim Module SDK headers, Variant is a nullable type:
It apparently can be null in Flexscript too, but there are some inconsistencies, and there is no well defined way to check for null (missing) values in the new dot-notation.
In particular:
- .value of an non-object node without data is NULL
- .value of an object node without data is not NULL, but the node itself!
- NULL == x and x == NULL in Flexscript are not equivalent and may yield different results
- comparing to nullvar works for .value of non-object nodes
- comparing to nullvar doesn't work for .value of object nodes
I noticed these things when I saw that somenode.value == NULL doesn't work as expected.
I suppose, line 17 is a bug, can't imagine it being a desired feature (see also lines 13 and 28).
The commutative property of the == operator is violated (lines 5-8 & 20-23). It is probably another bug.
My questions are:
- what is the recommended way [in dot notation] to check if a node has data?
- given a Variant value in Flexscript, how it should be checked for null value?