Re:Never trust a system that seems to be working
by bazoom42 on Monday October 17, 2022 @06:37PM
(#33240401)
Thats why JavaScript has both undefined and null!
[ Parent
| on HN ]
Re:Never trust a system that seems to be working
by deely3 on Tuesday October 18, 2022 @02:58AM
(#33243899)
Do we really need to differentiate between undef and null?
Re:Never trust a system that seems to be working
by bazoom42 on Tuesday October 18, 2022 @01:54PM
(#33251341)
Not necessarily, but it does allow a level of robustness to be able to distingish between values which have deliberately been assigned null, and values which have not been initialized correctly.
Re:Never trust a system that seems to be working
by mananaysiempre on Tuesday October 18, 2022 @05:40AM
(#33244924)
Lua does fine with only a nil, although it gets a tad annoying when you actually want to store a nil value in an array and end up creating a hole instead. (Arguably, the solution to that problem is to use your own marker object and not a nil when you need some sort of unspecified or default value which is not a literal absence of one.)