Bruno Jouhier (2013-08-05T07:13:49.000Z)
>From a dev standpoint what we need is a clean API to discriminate between
types. Sometimes we want to discriminate between objects (mutable) and
values (immutable), sometimes between functions and non functions,
sometimes between numbers, strings and others, etc. And we don't want to
have to write an extra test to exclude null from objects.

As we cannot break the existing typeof and its little warts, could we
introduce a new call, something like Object.typeInfo(x), that would return
a little hash like:

{ type: "int64", immutable: true, number: true, ... }
{ type: "string", immutable: true, number: false, ... }
{ type: "array", immutable: false, number, false, ... }

The idea it to have boolean flags like immutable/number/... to categorize
types. This way we can discriminate by testing a flag instead of having to
test complex combinations of typeof, Array.isArray, etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130805/9f527299/attachment.html>
domenic at domenicdenicola.com (2013-08-12T05:25:03.465Z)
>From a dev standpoint what we need is a clean API to discriminate between types. Sometimes we want to discriminate between objects (mutable) and values (immutable), sometimes between functions and non functions, sometimes between numbers, strings and others, etc. And we don't want to have to write an extra test to exclude null from objects.

As we cannot break the existing typeof and its little warts, could we
introduce a new call, something like Object.typeInfo(x), that would return
a little hash like:

```js
{ type: "int64", immutable: true, number: true, ... }
{ type: "string", immutable: true, number: false, ... }
{ type: "array", immutable: false, number, false, ... }
```

The idea it to have boolean flags like immutable/number/... to categorize
types. This way we can discriminate by testing a flag instead of having to
test complex combinations of typeof, Array.isArray, etc.