On Nov 7, 2011, at 10:03 AM, Allen Wirfs-Brock wrote:

> True, "in" and "instanceof" don't follow the rules.  I note that they were 
> added in ES3 and I have to wonder if they aren't another case of features 
> being added without sufficient thought being given to maintaining consistency 
> of behavior throughout the language. I don't know, I wasn't there.

I was not there for those, either. I talked with the Netscape folks who were, 
though. The 'in' mismatch is even more vexing because IE was forcing at the 
time, ultimately to great success in ES5, all other implementations to treat 
for (i in null); and for (i in undefined); loops as zero-iteration non-errors.

'instanceof' is broken in a number of ways.

Let's not get into the ES3-era Object.prototype extensions, especially 
propertyIsEnumerable (which does *not* climb the prototype chain, whereas 
for/in and in do) or isPrototypeOf. Ok, I named 'em. Shutting up now.

Really I think this is more committee selection bias shift and a failure to 
review the whole to check various kinds of consistency. We need to do better, 
not saying we will or throwing stones backward in time here.


> The same can be said for a few cases in the Object functions that were added 
> for ES5.  If I had the same depth of understanding of the internals of the 
> language as I do now, I probably would have objected to those variances.

Yup. Evolution is like that.

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

Reply via email to