typeof symbol (Was: Sept 19 TC39 Meeting Notes)
Axel Rauschmayer
axel at rauschma.de
Sat Sep 29 11:50:11 PDT 2012
> I agree with Tom, "object" is the best choice if we are to avoid extending typeof's codomain. If we choose to extend, then your best case made above arguess for "symbol", not "string".
I’ve been wondering: instead of fixing typeof, wouldn’t it be simpler to extend instanceof, by introducing new types:
- ReferenceType: to check whether a value is an object. Currently, objects such as Object.create(null) and Object.prototype are objects that are not instanceof Object.
- ValueType: for primitives and possibly future value objects.
- PrimitiveBoolean: for primitive booleans, same as typeof x === 'boolean'
- etc.
Should there ever be guards in the future, instanceof MyGuard would also make sense.
Axel
--
Dr. Axel Rauschmayer
axel at rauschma.de
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120929/1090e3f4/attachment-0001.html>
More information about the es-discuss
mailing list