On 06/25/2014 05:40 PM, Robert O'Callahan wrote:
On Thu, Jun 26, 2014 at 8:06 AM, Jason Orendorff <jorendo...@mozilla.com <mailto:jorendo...@mozilla.com>> wrote:

    An alternative involves letting you modify JS code just before
    it's compiled (source-to-source transformation). This is more
    general (you could modify the instrumented code arbitrarily, and
    react synchronously as it executes) but maybe that's undesirable.
    It's not clear that transformed source would interact nicely with
    other tools, like the debugger. And a usable API for this is a
    tall order.


Why is a usable S2S API difficult to produce?

A while ago I spent a few years doing dynamic analysis of Java code. Although the VMs had a lot of tracing and logging hooks, bytecode instrumentation was always more flexible and, done carefully, almost always more performant. I had to write some libraries to make it easy but tool builders enjoy writing and reusing those :-).

I meant "usable" in the Donald Norman sense. The underlying source-transformation hook could be quite simple, and yet completely beyond the people who actually have a use for it. How many potential users are willing and ready to munge ASTs by hand?

Bug 884602 contains a patch for the hook alone. I'd love to
- land that patch (it needs tests)
- write an addon that makes it easy to play with instrumentation of content JS
- post a video demoing it

But it's very hard to justify doing that instead of, say, ES6 classes.

-j
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to