Le 4 août 2013 à 01:39, Brendan Eich <[email protected]> a écrit :

> Brendan Eich wrote:
>> Claude Pache wrote:
>>> Fixing `typeof` of old (null) and new value types would be a solution, but 
>>> I'm rather definitely considering something like the defunct 
>>> `Object.isObject()`
> 
> I forgot to add that my patch for 
> https://bugzilla.mozilla.org/show_bug.cgi?id=749786 includes
> 
> Object.isObject(x) // false unless x is an object
> Object.isValue(x)   // true for primitives and value objects
> 
> The idea: isObject returns true for all the new value object types and the 
> reference-semantics objects found in JS today, while isValue returns true for 
> all compare-by-value types, whether the legacy primitives (undefined, null, 
> boolean, number, string) or the new-in-ES7 value objects.
> 
> /be

Ok. What I am most interested, when I test for an "object", is roughly that I 
am able to get or set properties on it (ignoring restrictions or special cases 
like freezing, etc., and, in order to shorten the test, forgetting functions 
that are not supposed to occur). Or that it can be used like an object created 
by `new Object` (an Object-like). This probably coincides with 
`!Object.isValue`. Likely, I won't want to treat `1L` like `{ }` and 
differently from `1`.

That numbers are non-objects but int64 are objects is much more an 
implementation detail than a relevant distinction for the programmer. So, I 
consider that `typeof int64(0) === "object"` and your `Object.isObject` are 
about as useless than `typeof null === "object"`.

—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to