You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Ahh, ok - so being able to execute an array of functions one after the other?

    Something like this is actually very close to doing exactly what you want:

    arr = [];
    arr.push({callback:console.log.bind(consĀ­ole,"qwertz\n")});
    E.toUint8Array(arr)
    

    However because it runs through once to count the elements it actually ends up calling everything twice. I guess a E.count(...) would actually serve two purposes.

    But does anyone else have any thoughts about whether this would get used?

    Personally it feels like a very niche thing and I'm not too sure of the uses. I mean, if eval allowed you to pass in a function then you could just do arr.forEach(eval) for a (probably faster) effect... and on a lot of platforms just doing:

    function go() {
      "compiled";
      en.reset();
      console.log("qwertz\n");
      en.set();
      console.log("asdf\n");
    }
    

    would be more readable and significantly faster.

    To be honest the best thing would be to just make the interpreter itself able to 'fast path' simple JavaScript functions so they executed extremely quickly - then we wouldn't need a lot of this messing around.

About

Avatar for Gordon @Gordon started