4 ms·
A language that truly supports null has monadic types, meaning that typed value (scalar, string, object, etc) or something else is specifically tracked (null, u
by cdumler 7y ago
A language that truly supports null has monadic types, meaning that typed value (scalar, string, object, etc) or something else is specifically tracked (null, undefined, etc). Languages that do not natively support that often have developers that cheat, where they assign some particular value to represent null. Commonly, this is 0 or -1 in numbers and an empty or literal "null" in strings. This works fine unless these values appear actually as legitimate values.
- perl4ever 7y agoLately, I program in a language that has distinct concepts of Null and Empty and Nothing and the empty string ("") and arrays that are not Empty but contain zero elements. And of course NUL characters. This is obviously at least five times as good as just having one option for null.
- speedplane 7y ago> arrays that are not Empty but contain zero elements What is an array that is not empty but contains zero elements?
- saagarjha 7y agoSounds like a trick question. How about the array of the largest number?
- anonymfus 7y agoIIRC in Visual Basic these are arrays with lower bound bigger than upper bound.
- perl4ever 7y ago...but sometimes you can observe this and sometimes you can't.
- perl4ever 7y agoWell, Empty is a special value in VBA. And I forgot to mention, there are two kinds of "empty" arrays that are not Empty. So it's six times as good as a normal language. Here's an example: ' x can be anything, including an array, but ' defaults to the value Empty. Dim x ' y is an array of values that can be anything, ' which defaults to an empty array. Dim y() ' Initialize x as an empty array x = Array() ' The following two statements print 0 and -1. Debug.Print LBound(x) Debug.Print UBound(x) ' The following two statements error with ' "Subscript out of range" even though y ' is also a kind of empty array. Debug.Print LBound(y) Debug.Print UBound(y)
- robbya 7y agoWhich language?