'void' as a value

Claude Pache claude.pache at gmail.com
Mon Sep 9 02:41:25 PDT 2013

Le 9 sept. 2013 à 10:35, David Bruant <bruant.d at gmail.com> a écrit :

> Le 08/09/2013 21:39, Brendan Eich a écrit :
>> In no case does anyone that I've spoken to, on TC39 or anywhere else around this planet, want *yet another* bottom type and singleton value a la null and undefined. No one. Those who speak Spanish and nearby languages tend to say "¡Basta!" -- I'm not kidding :-|.
> Two values are already arguably (!) a regrettable feature https://github.com/DavidBruant/ECMAScript-regrets/issues/26
> David

For me, it is a excellent feature, if we get the correct semantic:
* `undefined` means "no value", or "nothing";
* `null` means "empty value", or (well) "null".

Practical usefulness:
* ES5: JSON stringification of object: `null` means `null`, and `undefined` means "no value, don't include the corresponding key".
* ES6: default values in function arguments (and maybe destructuring assignment?): `null` means `null`, and `undefined` means "no value, take the default".


More information about the es-discuss mailing list