BTF Measurements

John J Barton johnjbarton at
Tue Mar 13 12:39:49 PDT 2012

On Tue, Mar 13, 2012 at 9:47 AM, Kevin Smith <khs4473 at> wrote:
> Hi John,
>>     (function() {
>>         var self = this;
>>         (function() { console.log(self); });
>>     });
> 1.  As stated above, it's assumed that BTFs will be preferred for clarity or
> brevity gains, even if bound-this is not required.  "Opting out" of BTFs is
> no different than using classic functions, so I can't see that there is any
> cost involved.

The cost comes from using BTF in cases where it will give erroneous
results.  If BTF exists, the next generation of JS developers will
'never' use grand-dad's function syntax. They will consider that form
obscure and confusing. They won't recognize the cases where the old
form is needed. So they will pay a cost to opt out of BTF.

If any! All (non-member) function expressions are either:
   1. OO and want lexical 'this',
   2. functional and don't care about 'this',
   3. Want default 'this'
My claim is that category 1 > category 2 >>> category 3.  Only
category 3 incurs this cost I outline.


> kevin

More information about the es-discuss mailing list