Re: Scoped binding of a method to an object

2013-10-16 Thread Andreas Rossberg
On 15 October 2013 17:51, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Tue, Oct 15, 2013 at 3:39 AM, Andreas Rossberg rossb...@google.com wrote: On 15 October 2013 03:09, Allen Wirfs-Brock al...@wirfs-brock.com wrote: I still don't get why so many JS programmer with a FP orientation

Multiple globals and changing prototypes

2013-10-16 Thread Anne van Kesteren
I believe last time this came up here some people hard concerns so I was wondering whether that was still the case and what alternatives there might be. In https://www.w3.org/Bugs/Public/show_bug.cgi?id=20567 we're considering to define the behavior Gecko exhibits when moving a node between trees

Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Benjamin (Inglor) Gruenbaum
Splitting by one value or another seems to be a pretty common use case if Stack Overflow questions and personal experience are an indication. For example - and and /. Currently, the solution is to pass a regular expression to String.prototype.split . However, it would be nice to be able to

Re: Multiple globals and changing prototypes

2013-10-16 Thread Mark S. Miller
Keep in mind that if an object is non-extensible, its [[Prototype]] cannot be changed. On Wed, Oct 16, 2013 at 3:54 AM, Anne van Kesteren ann...@annevk.nl wrote: I believe last time this came up here some people hard concerns so I was wondering whether that was still the case and what

Re: Multiple globals and changing prototypes

2013-10-16 Thread Allen Wirfs-Brock
On Oct 16, 2013, at 7:25 AM, Mark S. Miller wrote: Keep in mind that if an object is non-extensible, its [[Prototype]] cannot be changed. And objects that are implemented using a Proxy don't use their [[Prototype]] slot (a Proxy they doesn't have one) or necessarily even their target's

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Rick Waldron
On Wed, Oct 16, 2013 at 8:54 AM, Benjamin (Inglor) Gruenbaum ing...@gmail.com wrote: Splitting by one value or another seems to be a pretty common use case if Stack Overflow questions and personal experience are an indication. For example - and and /. Currently, the solution is to pass a

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Benjamin (Inglor) Gruenbaum
On Wed, Oct 16, 2013 at 7:15 PM, Rick Waldron waldron.r...@gmail.com wrote: This is subjective, as I have no trouble reading and understanding what this means and is expected to do (also subjective). Of course, this is another way to do it that does not require knowing regular expressions. I

Re: Readdition of __proto__

2013-10-16 Thread Andrea Giammarchi
yeah, if you use an alias L the footgun image comes upside down too ``` L.__proto__ = null; // later on, in ES6 L.__proto__ = () pew, pew; ``` On Tue, Oct 15, 2013 at 11:01 PM, Brendan Eich bren...@mozilla.com wrote: Allen Wirfs-Brock wrote: On Oct 15, 2013, at 3:19 PM, Dean

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Andrea Giammarchi
I stopped here On Wed, Oct 16, 2013 at 5:54 AM, Benjamin (Inglor) Gruenbaum ing...@gmail.com wrote: ``` myString.split(/ |-|\/|\+/g); // this is no fun to read myString.split( ,-,/,+); // this is easier myString.split([ ,-,/,+]); // this is also easier. ``` easier for

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Andrea Giammarchi
also, this is the same: `myString.split(/[ -/+]/)` maybe it's better to explain those users that knowing RegExp might bring benefits for their purpose (coding) ? On Wed, Oct 16, 2013 at 10:14 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I stopped here On Wed, Oct 16, 2013 at

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Benjamin (Inglor) Gruenbaum
On Wed, Oct 16, 2013 at 8:18 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: also, this is the same: `myString.split(/[ -/+]/)` Yes, that's true, not sure how that works for multi character delimiters. maybe it's better to explain those users that knowing RegExp might bring benefits

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Andrea Giammarchi
typo: Non highly trained professionals should *do* simple things On Wed, Oct 16, 2013 at 11:03 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: How could change 12+ years of legacy be considered inexpensive ? Non highly trained professionals should be simple things or try to learn

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Andrea Giammarchi
How could change 12+ years of legacy be considered inexpensive ? Non highly trained professionals should be simple things or try to learn something new that won't hurt, that's why Stack Overflow exists in first place, to ask for help or explanations about things. This request sounds to me like I

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Brendan Eich
It's hard to add extra optional arguments to a long-standing built-in. People write code that passes an extra arg that has been ignored till the change; browsers that try shipping the new version then break that content, user blames browser (rightly so) but also the page, sometimes (not

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Benjamin (Inglor) Gruenbaum
On Wed, Oct 16, 2013 at 9:03 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: How could change 12+ years of legacy be considered inexpensive ? This proposal does not break anything, the only thing that will/might work differently is people passing an array to .split right now and

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Andrea Giammarchi
It does break in many ways as also Brendan said. `''.split(what, ever)` would break plus `some1,2thing.split([1,2])` you have no idea what you could find in legacy code ... so whatever a 12+ years old legacy does shold keep doing like that and if you really want to put your array in there

Re: Multiple globals and changing prototypes

2013-10-16 Thread Tom Van Cutsem
The relevant invariant for [[SetPrototypeOf]] is that if the target is non-extensible, and the operation returns true (i.e. appears to succeed), then [[GetPrototypeOf]] must return the same result as the value passed into [[SetPrototypeOf]]. This is what I got from the current ES6 draft:

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Andrea Giammarchi
also, to reply your question Are you against changes like `.contains` or `.startsWith` too? Absolutely not, and these are new methods indeed. Perfectly in line with what you wrote: Why have `str.contains` if you can just do `~str.indexOf`. Why have `.startsWith`, or `.indexOf` on arrays? You

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Rick Waldron
On Wed, Oct 16, 2013 at 4:25 PM, Benjamin (Inglor) Gruenbaum ing...@gmail.com wrote: On Wed, Oct 16, 2013 at 9:03 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: How could change 12+ years of legacy be considered inexpensive ? This proposal does not break anything, the only thing

Re: Should String.prototype.split accept variable arguments optionally?

2013-10-16 Thread Benjamin (Inglor) Gruenbaum
On Wed, Oct 16, 2013 at 11:46 PM, Rick Waldron waldron.r...@gmail.com wrote: What about the version with the overload accepting an Array instead? It seems more backwards compatible than the varargs version. I meant the version accepting an array `.split([a,b,c])` rather than `.split(a,b,c)`