google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.17k stars 578 forks source link

Desire a few of the new polyfill for Reflect and Proxy #2106

Closed stuartZhang closed 8 years ago

stuartZhang commented 8 years ago

Hello guys,

When will you implement the Reflect & Proxy polyfill for Google Traceur? By the way, the ES 7 function-binding feature (replacing Function.prototype.bind(...)) is desirable as well.

In Safari 5.x, the ES 6 API "Reflect.apply(...)" is still unavailable now.

johnjbarton commented 8 years ago

A shim library is available here: https://github.com/tvcutsem/harmony-reflect https://www.npmjs.com/package/harmony-reflect @stuartZhang we could take a dependency on Cutsem's code, but our runtime may also redefine some of the same functions. The first thing to try would be to include harmony-reflect in our polyfill set up for the compiler itself and see if the tests pass. Then we need to manually compare the functions to be sure we aren't missing issues.

For now I suggest you try the library and see if that is adequate.

arv commented 8 years ago

On the bind operator. It is still at stage 0. But if be happy if someone wanted to create a PR for it.

On proxies. Supporting this in es5 would be very costly. Pretty much every operation in your program would have to go through a runtime that would check if the operand is a proxy or not. I think it would be an interesting proof of concept but definitely not something usable in real production code.

stuartZhang commented 8 years ago

The 3rd-party polyfill "harmony-reflect" has been introduced into my project. Thanks.