BTF Measurements

Kevin Smith khs4473 at gmail.com
Fri Mar 16 06:44:07 PDT 2012


Hi Aymeric,

I'm glad we're on the same page.   I analyzed the code from that site and
got the same results as you.  The percentage of BTF candidates is 68% of
all function expressions, but the combined BTF candidates and object
literal methods are only 78%.

There are very few object literal methods in this sample, so in order to
explain the 78% we're going to have to dig into the "non-method" forms.

As you point out, event handlers are attached using the following idiom:

    element.onevent = function() { ...this... };

Although they are not trivially convertible to BTFs, event handlers as
above can generally be refactored like this (using a purely expository BTF
syntax):

    element.onevent = () => { ...element... };

or even:

    element.onevent = (evt) => { ...evt.target... };

I think think analysis supports the idea that BTFs are widely applicable.

kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120316/5b94c087/attachment.html>


More information about the es-discuss mailing list