We tried to do this in the early Harmony era. We never managed to get this to work without unacceptable performance and semantic issues. If you dig around the archives looking for scoped object extensions or method extensions you can see the discussion that was had.
It seems like wiki.ecmascript.org is no longer available. The proposal was up there. Maybe someone has a mirror of it somewhere? Erik On Wed, Jul 5, 2017, 13:24 T.J. Crowder <[email protected]> wrote: > On Wed, Jul 5, 2017 at 7:10 PM, Boris Cherny <[email protected]> > wrote: > > The use case is similar to Scala’s block scoped implicits. In my > > application code I want Array.prototype.indexOf to return an > > Option<number>, rather than number | -1. > > Why does it have to be called `indexOf`? Why not `fooIndexOf`, where `foo` > is a short app-specific prefix? Changing the meaning of `indexOf` seems > like changing black to white and running the risk of getting killed at the > next zebra crossing. > > On Wed, Jul 5, 2017 at 7:42 PM, Boris Cherny <[email protected]> > wrote: > > I tried that approach, but it doesn’t work when creating objects > > via literal notation ([], {}). A bit clumsy to have to write > > “new Array(1,2,3)", or “Array(1,2,3)” every time. > > Surely not too bad if you provide yourself a short array-creation wrapper, > like `a`? > > -- T.J. Crowder > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

