Jan 19 meeting notes

Brendan Eich brendan at mozilla.com
Thu Jan 20 13:06:04 PST 2011


On Jan 19, 2011, at 10:58 PM, Mark S. Miller wrote:

> Some on TC39 want ASI gone, but I think we are better off leaving it alone and working on clear added-value (and mostly non-breaking) Harmony changes, as sketched in
> 
> http://brendaneich.com/2011/01/harmony-of-my-dreams/
> 
> I just finished it. I think this post is *awesome*. Really. I recommend everyone read it and that we discuss this. I'm more enthusiastic about this than about several of the proposals I've spent reams of email advocating -- especially the various lightweight identity-free frozen values introduced by the # syntax. Well done!

Thanks!


> In the context of these proposals, I feel more strongly that we should fix === rather than introducing a separate fixed egal operator. I noticed your deep value equality examples were written using === rather than egal. No matter how broken it is, I don't think you'll be alone in this. So, when generalizing === to include its current behavior along with deep structural equality, which equality does it recur with? If ===, then
> 
>     #{x: 10, y: NaN} !== #{x: 10, y: NaN}
> 
> which I find bizarre. If === recurs with egal, that's a better semantics but is harder to explain. (Thanks to Cormac for having raised approximately this question earlier.)

As discussed, NaN is a hard case for hash-consing -- if there's a NaN you hash-miss and potentially bloat. It's survivable in my experience.

The idea of changing === to egal in Harmony is tempting but quite incompatible. A lot of devs have wised up to isNaN's broken-by-design conversion of its argument ToNumber, and use x !== x to detect NaN. We'd break them.

I also agree with Waldemar thant -0 === 0, which does not violate the equivalence relation ideal, is Out There. -0 leaks, people compare with === and (Waldemar's point) switch on it. I have no way to assess how deeply extant web JS depends on this, but it smells like trouble and there's not a huge win.

Separately, I do like the idea of a new pair of keyword-operators (contextual, we worked this out in the November meeting), say "is" and "isnt" (hat tip: CoffeeScript) or "eq" and "neq" (yuck), as sugar for egal (which could just be Object.eq as you've shown: http://wiki.ecmascript.org/doku.php?id=harmony:egal).

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110120/555c55c9/attachment.html>


More information about the es-discuss mailing list