> Object.prototype.valueOf as specified is essentially a call to the internal 
> ToObject operation that wrappers primitive values. I put it in to deal with 
> cases like getDefiningObject("some string", "match")

Oh my, I've just consulted the ECMAScript spec and it's true. But isn't that 
counter-intuitive?

- Object.prototype.valueOf: convert to object
- String.prototype.valueOf: convert to primitive (for instances of String and 
primitive strings)
- Number.prototype.valueOf: same as above, but for numbers
- etc.

Even if that can't be fixed any more, there could be a method Object.toObject() 
with more obvious semantics. I try to avoid "expert magic" when using a 
programming language and it seems like a shame that this kind of magic is 
necessary here ( {} and valueOf()).

Greetings,

Axel

-- 
Dr. Axel Rauschmayer

[email protected]
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



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

Reply via email to