undefined being treated as a missing optional argument
brendan at mozilla.org
Fri Apr 13 12:16:30 PDT 2012
The story for JS is
undefined is "no value"
null is "no object"
It's definitely a just-so story, and some listeners want their money
back, but we're stuck with two. For defaulting, undefined is the only
choice of an in-language sentinel you can express. No one wants to add
yet another bottom type and singleton value.
Domenic Denicola wrote:
> I'm sympathetic toward `undefined` as a sentinel for "no value of the expected type," whereas `null` means "we have a value of the expected type, but that value represents 'nothing.'" Not sure if anyone else sees it that way, though, and admittedly it's based on vague hand-wavey arguments.
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss