Re: String.prototype.repeat

2011-01-09 Thread Jorge
Or perhaps to overload * ? 'a' * 5 - a ? -- Jorge. On 09/01/2011, at 03:21, Devin Samarin wrote: I was looking at http://wiki.ecmascript.org/doku.php?id=strawman:string_dup and I thought I would come up with an implementation that would be suitable. Something that I think would be

Re: String.prototype.repeat

2011-01-09 Thread Jeff Walden
On 01/09/2011 06:02 AM, Jorge wrote: Or perhaps to overload * ? 'a' * 5 - a ? Probably a bridge too far. Operator overloading this way results in all those weird implicit conversion behaviors we all know and love (not), true. But at this point there's the matter of compatibility:

Re: String.prototype.repeat

2011-01-09 Thread Felipe Gasper
On 1/9/11 6:02 AM, Jorge wrote: Or perhaps to overload * ? 'a' * 5 - a Perl has the “x” operator for things like that... -FG ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Operator Overloading

2011-01-09 Thread Jürg Lehni
The mention of the term made me wonder: Is it wrong to dream of JavaScript with operator overloading? I have implemented it in Rhino's interpreter mode, and am using it in Scriptographer.org to be able to write much nicer code to deal with 2d vector arithmetics, and the benefits of that have

Re: Operator Overloading

2011-01-09 Thread Mike Samuel
2011/1/10 Jürg Lehni li...@scratchdisk.com: The mention of the term made me wonder: Is it wrong to dream of JavaScript with operator overloading? https://mail.mozilla.org/pipermail/es-discuss/2009-October/010068.html discusses it a bit and links to other discussions. I have implemented it in

Re: Operator Overloading

2011-01-09 Thread Mark S. Miller
There is a current strawman at http://wiki.ecmascript.org/doku.php?id=strawman:value_proxies. I like the direction it is headed. On Sun, Jan 9, 2011 at 3:26 PM, Mike Samuel mikesam...@gmail.com wrote: 2011/1/10 Jürg Lehni li...@scratchdisk.com: The mention of the term made me wonder: Is it

Operator Overloading

2011-01-09 Thread thaddee yann tyl
I see no reason to name the floordiv trap that way. Python has a good reason: they have more than one division operator (/ and //). The reason for it is that, at the beginning, the division operator behaved just like that of C: 1/2 gave 0, not 0.5. But Javascript already give the more accurate