ES3 experiments

Hi!

I know ES3 is unsupported. I just tried to put the compiled kotlin stdlib js file into a program which still is on ES3. I just wanted to see if it works. It complains about the keywords final and native which seem to be used in the stdlib as variable and function names.
Without having tried to set something up for a more modern ES version, I am wondering how this is supposed to work in newer version. Those keywords are still reserved in other version.

Thanks for input!

Edit:

function native(name) {
      if (name === void 0)
        name = '';
      this.name = name;
    }
var relativeEnd = end === undefined ? len : end >> 0;
      var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);
      while (k < final) {
        O[k] = value;
        k++;
      }

Hi RandomByte! Some of the keywords reserved in ES3, including final and native, are no longer reserved since ES5. Lexical grammar - JavaScript | MDN

I think unreserving unused keywords is a safe thing to do. It wouldn’t really break any code.

1 Like