Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thats why JavaScript has both undefined and null!


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.)


Do we really need to differentiate between undef and null?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: