FWIW, I think whatever contains "type" in modern JS should consider
`int32`, `float64`, and all TypedArrays plus it would be awesome to have a
way to define own types.
In any case, if your idea will be implemented, I think it should have named
Symbols for debugging sake.
```js
Symbol('undefined'),
Symbol('null'),
Symbol('boolean')
```
This would be at least consistent with current implementations of
`Symbol.iterator` and friends.
Best Regards
On Thu, May 14, 2015 at 5:29 PM, Alexander Jones <[email protected]> wrote:
> Just an idea, if it doesn't already exist somewhere.
>
> Reflect.type(x) would match the spec's Type(x) function, in that it would
> basically be a better, more convenient typeof, i.e.
>
> Reflect.types = {
> undefined: Symbol(),
> null: Symbol(),
> boolean: Symbol(),
> string: Symbol(),
> symbol: Symbol(),
> number: Symbol(),
> object: Symbol(),
> }
>
> Reflect.type(null) === Reflect.types.null
> Reflect.type(function() {}) === Reflect.types.object
>
> We weren't able to fix typeof null in harmony, but this seems like a good
> opportunity to introduce something new. Haven't thought about the
> repercussions of future support for new value types...
>
> Any thoughts?
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss