Scoped binding of a method to an object

David Bruant bruant.d at
Sun Oct 13 11:25:23 PDT 2013

Le 13/10/2013 20:03, Benjamin (Inglor) Gruenbaum a écrit :
> David Bruant <bruant.d at <mailto:bruant.d at>> wrote:
> > Concretely, attempted prolyfills, could be _-prefixed (that really 
> fits with what you call "poor-man's prefixing", I believe)
> > Authors would feel free to add something like 
> Array.prototype._shuffle or Array.prototype._last, or 
> EventTarget.prototype._on without worrying about collision with the 
> platform.
> What if I use two libraries that polyfill `_shuffle` or `_last` 
> differently (let's say with different behavior for an empty array for 
> `_last` or weaker guarantee on the randomness in `_shuffle`)?
What do you do today when a library overrides Array.prototype.concat 
with a different semantics?
What do you do when you load two libraries each defining a global $ with 
different semantics?

Apply every prevention/resolution mechanism you use today with global 
properties. Among other ideas:
* don't load libraries that are known to have conflicts (!!)
* isolate the code that enhance built-ins (preferably, run it before 
anything else and not in the middle of your application lifecycle)
* Define functions as non-configurable/non-writable in development mode 
to discover conflicts before pushing to production.

This proposal does not aim at solving the problem of library conflicts 
which existed before this proposal and should be solve independently.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list