BTF Measurements

Aymeric Vitte vitteaymeric at gmail.com
Wed Mar 14 14:18:30 PDT 2012


So BTF stands for "bound-this function expressions"

But it does include case b (don't care about "this")

Then in the next email you conclude :

"Interestingly, when we take the sum of BTF candidates and object 
literal methods, we account for over 90% of function expressions."

Is it surprising ?

  "This suggests that an additional short function syntax that does 
*not* bind 'this' may not be necessary."

??? Why ? Because except object literal methods (+/-50% for which the 
lexical this is not supposed to be needed) most of the functions are the 
b case ?

I should be missing something important... don't understand exactly what 
the analysis does highlight, thanks if you can give more details

Le 14/03/2012 13:46, Kevin Smith a écrit :
>
>     As far as I have understood "Total Function Expressions" is
>     supposed to return all functions that do not contain "this" in
>     their initial scope and that have a "var self=this" trick that is
>     used somewhere inside the function (ie function() {var
>     self=this;var b=function() {console.log('test')} is not a BTF
>     candidate because self is not used), correct ?
>
>
> Sorry, no.  As stated previously, I'm assuming for the purposes of 
> this analysis that BTFs will be used in cases where (a) we want 
> lexical "this" and (b) we don't care about "this" at all.  Why in the 
> second case?  Because BTF syntax will be more concise and will 
> generally express the intent better.
>
> When I started this research, I wasn't aware of the "tri-lambda" work 
> being done, and specifically the proposal that there be two short 
> function syntaxes:  one for classic functions (->) and one for bound 
> this (=>).  Clearly some of the BTF candidates could go either way, 
> and we really can't make that distinction in this analysis.
>
> kevin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120314/e6e8968d/attachment.html>


More information about the es-discuss mailing list