// es3 way
(function()
{
  var x = 1;
 
  return function()
  {
    return ++x;
  }
})();

// current es6/SM1.8 way
let(x = 1) function()
{
  return ++x;
}

// "new" more readable sugar
function()
{
  static x = 1; // hello c/c++
 
  return ++x;
}

Implementation, when compiling source code, just collects 'static' vars
from scope and wraps current scope to closure scope with collected vars  




_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to