Re: Operator overloading for non-value objects

2014-01-15 Thread Tristan Zajonc
Continuing the tangent. There are lots of other use cases for operator overloading with mutable objects. On this list, I previously discussed the desire for operator overloading on large mutable matrices. The lack of operator overloading is the biggest syntax annoyance for building numerics libr

Re: Equality Reform(ul)ation

2014-01-15 Thread Brendan Eich
Kevin Smith wrote: js> 0L == { valueOf: function() { return 0 } } typein:2:0 TypeError: no operator function found for == Is the Object-type operand converted to a primitive before the overload is matched? No, the multimethod dispatch algorithm runs. Even with To

Re: Equality Reform(ul)ation

2014-01-15 Thread Kevin Smith
> > >> js> 0L == { valueOf: function() { return 0 } } > > typein:2:0 TypeError: no operator function found for == > > Is the Object-type operand converted to a primitive before the overload >> is matched? >> > > No, the multimethod dispatch algorithm runs. Even with ToObject (I see I > left that o

Re: Rename Number.prototype.clz to Math.clz

2014-01-15 Thread Brendan Eich
This is a judgment call, I'm with Jason, I think we should revisit. I'm putting it on the TC39 meeting agenda. /be Allen Wirfs-Brock January 15, 2014 11:26 AM So we discussed all that when we made that decision. I understand that you disagree but is there any n

Re: Equality Reform(ul)ation

2014-01-15 Thread Brendan Eich
Andrea Giammarchi wrote: I would expect that to be `true` same as `0 == {valueOf:Number}` would be No, please do read what I posted. Value object operator dispatch is different and does not use toString or valueOf on an object operand. /be ___ es-d

Re: Equality Reform(ul)ation

2014-01-15 Thread Brendan Eich
Kevin Smith wrote: js> 0L == "0" typein:2:0 TypeError: no operator function found for == And what does this do? 0L == { valueOf() { return 0 } } js> 0L == { valueOf: function() { return 0 } } typein:2:0 TypeError: no operator function found for == Is the Object-type

Re: .next('yo') in newborn generators

2014-01-15 Thread David Bruant
Le 15/01/2014 17:50, Allen Wirfs-Brock a écrit : On Jan 15, 2014, at 8:32 AM, David Bruant wrote: Hi, Playing with the test cases of the regenerator project [1], I came across a case and was wondering what the intention of the spec is given that Firefox and Chrome recent implementations div

Re: Rename Number.prototype.clz to Math.clz

2014-01-15 Thread Alex Kocharin
What if we add a uint64 type, we'd just have Math.clz64 (which is better than have X.clz returning something depending on a type, so you always have to check the type first) 15.01.2014, 23:18, "Jason Orendorff" : > ES6 adds a clz function, but it's a method of Number.prototype.clz > rather tha

Re: Rename Number.prototype.clz to Math.clz

2014-01-15 Thread Allen Wirfs-Brock
On Jan 15, 2014, at 11:18 AM, Jason Orendorff wrote: > ES6 adds a clz function, but it's a method of Number.prototype.clz > rather than Math.clz. > > The rationale for this decision is here (search for clz in the page): > http://esdiscuss.org/notes/2013-07-25 > > Can we reverse this, for users

Rename Number.prototype.clz to Math.clz

2014-01-15 Thread Jason Orendorff
ES6 adds a clz function, but it's a method of Number.prototype.clz rather than Math.clz. The rationale for this decision is here (search for clz in the page): http://esdiscuss.org/notes/2013-07-25 Can we reverse this, for users' sake? The pattern in ES1-5 is quite strong: math functions go on t

Re: Equality Reform(ul)ation

2014-01-15 Thread Andrea Giammarchi
I would expect that to be `true` same as `0 == {valueOf:Number}` would be On Wed, Jan 15, 2014 at 5:10 AM, Kevin Smith wrote: > >>> js> 0L == "0" >>> typein:2:0 TypeError: no operator function found for == >>> >> >> > And what does this do? > > 0L == { valueOf() { return 0 } } > > Is the Ob

Re: .next('yo') in newborn generators

2014-01-15 Thread Allen Wirfs-Brock
On Jan 15, 2014, at 8:32 AM, David Bruant wrote: > Hi, > > Playing with the test cases of the regenerator project [1], I came across a > case and was wondering what the intention of the spec is given that Firefox > and Chrome recent implementations diverge. > Apologies for not reading all the

.next('yo') in newborn generators

2014-01-15 Thread David Bruant
Hi, Playing with the test cases of the regenerator project [1], I came across a case and was wondering what the intention of the spec is given that Firefox and Chrome recent implementations diverge. Apologies for not reading all the previous discussions on this edge case. Test case: js fu

Equality Reform(ul)ation

2014-01-15 Thread Kevin Smith
> > >> js> 0L == "0" >> typein:2:0 TypeError: no operator function found for == >> > > And what does this do? 0L == { valueOf() { return 0 } } Is the Object-type operand converted to a primitive before the overload is matched? ___ es-discuss mailing

Re: Operator overloading for non-value objects

2014-01-15 Thread Anne van Kesteren
On Wed, Jan 15, 2014 at 7:35 AM, Sebastian Markbåge wrote: > At risk of derailing the conversation with a tangent... I don't understand > the premise. Why is it so important that URLs are mutable? (Other than > already being drafted that way.) That's a good question. I mostly took after / Locati