typeof symbol (Was: Sept 19 TC39 Meeting Notes)

Brendan Eich brendan at mozilla.org
Sat Sep 29 13:53:36 PDT 2012

Herby Vojčík wrote:
> So, symbols look to me more like primitives/atoms (that means, not an 
> object nor function) and so they should have their own typeof... 

That's progress, if you agree typeof aSymbol should not return "string" ;-).

However, what you say about "I hold no subvalues, my identity is my 
value" can fit an empty frozen object too.

Anyway if you feel strongly typeof should return "symbol" not "object" 
we have to face the dragons around the edge of the known typeof map. 
Fortunately IE shipped some in the known world. I could buy "symbol" but 
I'm also inclined toward "int64", "uint64", and other value-object 
typeof results in the future.

The hard thing is the non-zero risk of breaking some code by officially 
extending typeof, vs. the zero risk of using "object". The latter won't 
break any code that already might fail due to the full range of {null, 
pre-ES5 objects, frozen/sealed via ES5 API usage objects}.


More information about the es-discuss mailing list